{"record":{"id":"174f9c47cd3b9aa2","repo":"BoundaryML/baml","slug":"dependency-not-found","errorCode":null,"errorMessage":"Dependency: {} not found","messagePattern":"Dependency: (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-lib/baml-core/src/ir/ir_hasher/mod.rs","lineNumber":97,"sourceCode":"    pub fields: Arc<Vec<(String, Arc<TypeNonStreaming>)>>,\n}\n\n#[derive(Clone)]\npub struct EnumSignatureDetails {\n    pub values: Arc<Vec<String>>,\n}\n\nfn recursively_collect_dependencies<'a>(\n    name: &str,\n    shallow_hash: &'a HashMap<&str, ShallowHash>,\n    find_dependencies: fn(&str, &'a HashMap<&str, ShallowHash>) -> Option<&'a Vec<String>>,\n) -> Result<Vec<&'a String>> {\n    // Recursively collect all dependencies\n    let mut seen = HashSet::new();\n    let mut queue = vec![name];\n    while let Some(name) = queue.pop() {\n        let dep_hash = find_dependencies(name, shallow_hash)\n            .ok_or(anyhow::anyhow!(\"Dependency: {} not found\", name))?;\n        for dep in dep_hash {\n            // For recursive dependencies, we want to insert self back into the queue\n            // This is why seen starts empty, so we actually insert the dependency\n            // back into the queue, when/if we see it again\n            if seen.insert(dep) {\n                queue.push(dep);\n            }\n        }\n    }\n\n    // Sort dependencies so hasher is deterministic\n    let mut dependencies = seen.into_iter().collect::<Vec<_>>();\n    dependencies.sort();\n    Ok(dependencies)\n}\n\nimpl Signature {\n    pub fn display_name(&self) -> &str {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-lib/baml-core/src/ir/ir_hasher/mod.rs#L79-L115","documentation":"During BAML IR construction, recursively_collect_dependencies walks the dependency graph of a named type via a work-queue over the precomputed shallow-hash map. When a name popped from the queue has no entry in that map (find_dependencies returns None), the walk aborts with 'Dependency: {} not found'. This means a referenced type/class/enum is missing from the intermediate representation.","triggerScenarios":"Calling Ir::new (via ir_hasher::new) when a type's declared dependency string is not a key in the shallow_hash map, e.g. a function/class references a type that was never defined in the .baml sources.","commonSituations":"Typo in a type reference inside a .baml file; a renamed or deleted class still referenced elsewhere; splitting .baml files and forgetting to include the file defining a dependency; stale generated code referencing removed types.","solutions":["Search .baml files for the dependency name printed in the error and define the missing class/enum/type","Fix typos in the type reference that points at the missing name","Ensure all .baml files containing the definition are included in the source set passed to the IR builder","Regenerate/clean cached IR artifacts after refactoring type names"],"exampleFix":"// before (in .baml)\nfunction Foo() -> MissingType\n// after\nclass MissingType { key string }\nfunction Foo() -> MissingType","handlingStrategy":"validation","validationCode":"// before building IR, verify every referenced type exists\nfn validate_deps(shallow: &HashMap<&str, ShallowHash>) -> Result<()> {\n  for (name, h) in shallow {\n    for dep in h.dependencies() {\n      if !shallow.contains_key(dep.as_str()) {\n        return Err(anyhow!(\"missing dependency {} referenced by {}\", dep, name));\n      }\n    }\n  }\n  Ok(())\n}","typeGuard":"fn dependency_exists(name: &str, shallow: &HashMap<&str, ShallowHash>) -> bool {\n  shallow.contains_key(name)\n}","tryCatchPattern":null,"preventionTips":["Grep .baml files for every referenced type name after renames","Keep all .baml definitions in baml_src so nothing is excluded","Run baml CLI compile/fmt checks in CI to surface dangling references","Avoid hand-editing generated code that references IR names"],"tags":["baml","ir","dependency-not-found","build"],"backgroundTag":"entity-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}