{"record":{"id":"d5a114485d973e93","repo":"BoundaryML/baml","slug":"item-not-found","errorCode":null,"errorMessage":"Item: {} not found","messagePattern":"Item: (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-lib/baml-core/src/ir/ir_hasher/mod.rs","lineNumber":162,"sourceCode":"        Self::new(SignatureType::TypeAlias, name, shallow_hash)\n    }\n\n    fn new_client(name: &str, shallow_hash: &HashMap<&str, ShallowHash>) -> Result<Self> {\n        Self::new(SignatureType::Client, name, shallow_hash)\n    }\n\n    fn new_retry_policy(name: &str, shallow_hash: &HashMap<&str, ShallowHash>) -> Result<Self> {\n        Self::new(SignatureType::RetryPolicy, name, shallow_hash)\n    }\n\n    fn new(\n        r#type: SignatureType,\n        name: &str,\n        shallow_hash: &HashMap<&str, ShallowHash>,\n    ) -> Result<Self> {\n        let item = shallow_hash\n            .get(name)\n            .ok_or(anyhow::anyhow!(\"Item: {} not found\", name))?;\n\n        let mut all_dependencies = HashSet::new();\n\n        let interface_hash = {\n            let dependencies =\n                recursively_collect_dependencies(name, shallow_hash, |name, shallow_hash| {\n                    shallow_hash.get(name).map(|h| &h.interface_dependencies)\n                })?;\n\n            all_dependencies.extend(dependencies.iter().cloned());\n\n            let mut hasher = std::collections::hash_map::DefaultHasher::new();\n            item.interface_hash.hash(&mut hasher);\n            for dep in dependencies {\n                let dep_hash = shallow_hash\n                    .get(dep.as_str())\n                    .ok_or(anyhow::anyhow!(\"Dependency: {} not found\", dep))?;\n                dep.as_str().hash(&mut hasher);","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-lib/baml-core/src/ir/ir_hasher/mod.rs#L144-L180","documentation":"ir_hasher::new looks up the signature item's own name in the shallow_hash map to compute its interface/implementation hashes. If the type/function being hashed has no ShallowHash entry, construction fails with 'Item: {} not found'. The shallow-hash map is built from the AST, so the name is absent from everything parsed.","triggerScenarios":"Calling ir_hasher::new with a SignatureType/name whose entry is absent from shallow_hash — i.e. hashing a symbol that was not registered during the shallow-hash collection pass.","commonSituations":"Referencing a function or type in .baml that is not defined anywhere; a signature referencing a symbol dropped during parsing; mismatch between collected definitions and the names requested for hashing.","solutions":["Define the missing item named in the error in a .baml file","Fix the reference so it points to an existing definition","Check that the build collects all .baml sources so the shallow hash includes the item","Clear generated/cached IR and rebuild"],"exampleFix":"// before\nfunction Recommend() -> PodcastSh\n// after\nclass PodcastSh { id int }\nfunction Recommend() -> PodcastSh","handlingStrategy":"validation","validationCode":"// ensure the item is registered before hashing\nif !shallow_hash.contains_key(name) {\n  return Err(anyhow!(\"Item {} missing from shallow hash; check .baml definitions\", name));\n}","typeGuard":"fn item_registered(name: &str, shallow: &HashMap<&str, ShallowHash>) -> bool {\n  shallow.contains_key(name)\n}","tryCatchPattern":"match ir_result {\n  Err(e) if e.to_string().contains(\"not found\") => fix_missing_baml_definition(&e),\n  Err(e) => return Err(e),\n  Ok(ir) => ir,\n}","preventionTips":["Define every function/class used in signatures","Commit all .baml files that define referenced symbols","Regenerate IR after any rename refactor"],"tags":["baml","ir","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-14T05:17:10.506Z"}