#34244·dagster

[dagster-dbt] select_unique_ids raises TypeError for YAML selectors with indirect_selection: cautious/buildable

Author: AcarlsoCreated Sep 30, 2026Updated Sep 30, 2026

What's the issue?

Not a duplicate of #33351 (run-time skip under non-eager indirect selection, fixed in 1.13.6). This is a definition-time crash: resolving a selectors.yml selector whose criteria set indirect_selection: cautious or buildable raises in select_unique_ids whenever a selected node has tests.

Via build_dbt_asset_selection(..., dbt_selector=...) in define_asset_job, this fails the whole code location:

DagsterInvalidDefinitionError: Failed to resolve asset job <job>
TypeError: 'NoneType' object is not iterable
  dbt/graph/selector.py, line 290, in expand_selection
    if indirect_selection == IndirectSelection.Eager or set(

@dbt_assets(selector=...) and DbtProjectComponent selector: go through the same function (not separately verified).

Root cause: _select_unique_ids_from_manifest wraps nodes in _DictShim, whose __getattr__ returns self.get(item). dbt nodes expose depends_on_nodes as a property (self.depends_on.nodes); manifest.json has no such key, so the shim returns None. dagster-dbt forces INDIRECT_SELECTION=Eager, which short-circuits before the property is read. A YAML criterion with indirect_selection: cautious|buildable overrides that per criterion, and set(node.depends_on_nodes) in NodeSelector.expand_selection / incorporate_indirect_nodes becomes set(None).

What did you expect to happen?

Same unique_ids as dbt ls --selector <name>.

How to reproduce?

Any project where the selected model has at least one test:

yaml
selectors:
  - name: repro
    definition:
      method: fqn
      value: <model_with_a_test>
      indirect_selection: cautious
python
from dagster_dbt.utils import select_unique_ids

select_unique_ids(select="fqn:*", exclude="", selector="repro", project=None, manifest_json=manifest)

Observed on a real project manifest (count = selected unique_ids):

indirect_selection result
eager OK (3)
cautious TypeError
buildable TypeError
empty OK (1)

Plain select= strings are unaffected (global flag forced to eager). Adding a depends_on_nodes key to each node dict makes cautious/buildable return the same 3 ids as eager.

Suggested fix (a class property takes precedence over __getattr__):

python
class _DictShim(dict):
    @property
    def depends_on_nodes(self):
        return (self.get("depends_on") or {}).get("nodes", [])

Dagster version

dagster 1.13.8, dagster-dbt 0.29.8, dbt-core 1.11.11, Python 3.11. _DictShim is unchanged on master.

Deployment type

Local

Deployment details

Windows; not OS-specific.

Additional information

_DictShim was reintroduced for performance in #20550.