BoundaryML/baml · error
Item: {} not found
Error message
Item: {} not found What it means
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.
Source
Thrown at engine/baml-lib/baml-core/src/ir/ir_hasher/mod.rs:162
Self::new(SignatureType::TypeAlias, name, shallow_hash)
}
fn new_client(name: &str, shallow_hash: &HashMap<&str, ShallowHash>) -> Result<Self> {
Self::new(SignatureType::Client, name, shallow_hash)
}
fn new_retry_policy(name: &str, shallow_hash: &HashMap<&str, ShallowHash>) -> Result<Self> {
Self::new(SignatureType::RetryPolicy, name, shallow_hash)
}
fn new(
r#type: SignatureType,
name: &str,
shallow_hash: &HashMap<&str, ShallowHash>,
) -> Result<Self> {
let item = shallow_hash
.get(name)
.ok_or(anyhow::anyhow!("Item: {} not found", name))?;
let mut all_dependencies = HashSet::new();
let interface_hash = {
let dependencies =
recursively_collect_dependencies(name, shallow_hash, |name, shallow_hash| {
shallow_hash.get(name).map(|h| &h.interface_dependencies)
})?;
all_dependencies.extend(dependencies.iter().cloned());
let mut hasher = std::collections::hash_map::DefaultHasher::new();
item.interface_hash.hash(&mut hasher);
for dep in dependencies {
let dep_hash = shallow_hash
.get(dep.as_str())
.ok_or(anyhow::anyhow!("Dependency: {} not found", dep))?;
dep.as_str().hash(&mut hasher);View on GitHub (pinned to bd85ce9dee)
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
Example fix
// before
function Recommend() -> PodcastSh
// after
class PodcastSh { id int }
function Recommend() -> PodcastSh Defensive patterns
Strategy: validation
Validate before calling
// ensure the item is registered before hashing
if !shallow_hash.contains_key(name) {
return Err(anyhow!("Item {} missing from shallow hash; check .baml definitions", name));
} Type guard
fn item_registered(name: &str, shallow: &HashMap<&str, ShallowHash>) -> bool {
shallow.contains_key(name)
} Try / catch
match ir_result {
Err(e) if e.to_string().contains("not found") => fix_missing_baml_definition(&e),
Err(e) => return Err(e),
Ok(ir) => ir,
} Prevention
- Define every function/class used in signatures
- Commit all .baml files that define referenced symbols
- Regenerate IR after any rename refactor
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Dependency: {} not found
- {} `{}` not found.
- {} `{}` not found. Did you mean: {}?
- {} `{}` not found. Did you mean one of: {}?
- function `{function_name}` not found
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/d5a114485d973e93.
Report an issue: GitHub.