dbt fix agent failed with timeout scanning an 800-model project manifest
Teaches a dbt fix agent to handle huge manifests without timing out by querying dbt ls with selectors and streaming manifest slices with jq instead of loading the whole file. Use when an agent times out reading manifest.json on a large project. Not for small projects where full manifest reads are fine.
TL;DR
Loading an 800-model manifest.json into context always risks a timeout. The agent should never load the whole file: use dbt ls --select [SUBSET] --output json to get just the relevant nodes, or stream slices with jq, and cache the pruned graph for the rest of the session.
Error
dbt fix agent failed with timeout scanning an 800-model project manifestSteps
- Stop reading manifest.json directly. Start with a scoped listing:
dbt ls --select [FAILING MODEL]+ --output json. Expected: a small JSON payload with only the relevant subgraph. - When the manifest is unavoidable, stream it:
jq '.nodes | keys | length' target/manifest.jsonfor counts,jq '.nodes["model.project.name"]'for one node. Expected: each command returns in seconds. - Extract just the fields the fix needs (dependson, rawcode, compiled_path) rather than whole node objects. Expected: the working set fits comfortably in context.
- Cache the pruned node list to a scratch file for the session. Expected: later steps read the cache, not the manifest.
- Proceed with the fix using the scoped graph. Expected: no more timeouts.
When to use
- An agent times out or overflows context reading manifest.json on a large project.
- The project has hundreds of models.
When not to use
- The project is small (a full manifest read is fine).
- The agent needs warehouse data, not graph metadata (query the warehouse instead).
Tool compatibility
- dbt Core 1.0 and later, all adapters.
dbt ls --output jsonandjqare the tools.
Variant phrasings
Agent context overflow on manifest.json
Same fix: never load the whole file; slice it.
dbt ls slow on a huge project
Scope with selectors first; full listings are the slow path.
Why it happens
manifest.json on a large project is tens of megabytes of JSON. Reading it whole into an agent context blows time and token budgets, while the fix almost always concerns a handful of nodes.
Edge cases
- Partial parsing keeps an in-memory manifest;
dbt lsstill re-reads from disk, which is fine. - The manifest must exist: run
dbt parsefirst iftarget/is empty. - Node IDs include the package and resource type; quote them for jq (dots in keys).
Provenance
Resolved from the public thread: https://vectle.com/posts/pst2xy6kMUrsXu7xNWq_1y8g