The problem I’m having
dbt failed to parse model template. But the error message doesn’t include the model file that causes the error.
I’m using python 3.12.4, dbt 1.8.4, dbt-athena 1.8.4. I have the following package installed.
- package: dbt-labs/dbt_utils
version: 1.1.1 - package: dbt-labs/dbt_external_tables
version: 0.8.7 - package: dbt-labs/codegen
version: 0.11.0
The context of why I’m trying to do this
My company uses dbt with dagster. It has a repo with both dagster and dbt codes. dbt codes are stored in the /dbt folder in this repo. I want to experiment the new dbt unit test feature so I cloned the project and trying to run some basic dbt command such as dbt compile. However I got this error that doesn’t have much useful information to troubleshoot.
What I’ve already tried
Don’t know how to proceed to troubleshoot this. The repo has hundreds of model files. It’s hard for me to find the files that may cause the error.
Some example code or error messages
dbt list --profiles-dir config
03:54:46 Running with dbt=1.8.4
03:54:46 Registered adapter: athena=1.8.4
03:54:46 Unable to do partial parsing because saved manifest not found. Starting full parse.
03:54:48 Encountered an error:
'NoneType' object is not subscriptable
03:54:48 Traceback (most recent call last):
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/cli/requires.py", line 138, in wrapper
result, success = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/cli/requires.py", line 101, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/cli/requires.py", line 218, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/cli/requires.py", line 247, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/cli/requires.py", line 294, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/cli/requires.py", line 320, in wrapper
ctx.obj["manifest"] = parse_manifest(
^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/manifest.py", line 1898, in parse_manifest
manifest = ManifestLoader.get_full_manifest(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/manifest.py", line 330, in get_full_manifest
manifest = loader.load()
^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/manifest.py", line 435, in load
self.parse_project(
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/manifest.py", line 733, in parse_project
parser.parse_file(block)
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/base.py", line 484, in parse_file
self.parse_node(file_block)
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/base.py", line 445, in parse_node
self.render_update(node, config)
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/models.py", line 348, in render_update
super().render_update(node, config)
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/base.py", line 421, in render_update
context = self.render_with_context(node, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/parser/base.py", line 270, in render_with_context
get_rendered(parsed_node.raw_code, context, parsed_node, capture_macros=True)
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt/clients/jinja.py", line 146, in get_rendered
rendered = render_template(template, ctx, node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt_common/clients/jinja.py", line 539, in render_template
return template.render(ctx)
^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/dbt_common/clients/jinja.py", line 144, in render
return self.environment.handle_exception()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/project/dbt/dbt-env/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 46, in top-level template code
TypeError: 'NoneType' object is not subscriptable