{"record":{"id":"3c1a061f02ecadcf","repo":"BoundaryML/baml","slug":"not-found-did-you-mean-one-of","errorCode":null,"errorMessage":"{} `{}` not found. Did you mean one of: {}?","messagePattern":"(.+?) `(.+?)` not found\\. Did you mean one of: (.+?)\\?","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-lib/baml-core/src/ir/ir_helpers/error_utils.rs","lineNumber":70,"sourceCode":"\n#[macro_export]\nmacro_rules! error_not_found {\n    ($type:expr, $name:expr, $candidates:expr) => {{\n        let suggestions =\n            $crate::ir::ir_helpers::error_utils::sort_by_match($name, $candidates, Some(5));\n        match suggestions.len() {\n            0 => anyhow::bail!(\"{} `{}` not found.\", $type, $name),\n            1 => {\n                anyhow::bail!(\n                    \"{} `{}` not found. Did you mean: {}?\",\n                    $type,\n                    $name,\n                    suggestions[0]\n                )\n            }\n            _ => {\n                let suggestions = suggestions.join(\", \");\n                anyhow::bail!(\n                    \"{} `{}` not found. Did you mean one of: {}?\",\n                    $type,\n                    $name,\n                    suggestions\n                )\n            }\n        }\n    }};\n}\n\n#[macro_export]\nmacro_rules! error_unsupported {\n    ($type:expr, $name:expr, $reason:expr) => {\n        anyhow::bail!(\"Unsupported {} `{}`: {}\", $type, $name, $reason)\n    };\n}\n","sourceCodeStart":52,"sourceCodeEnd":87,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-lib/baml-core/src/ir/ir_helpers/error_utils.rs#L52-L87","documentation":"Multi-suggestion arm of error_not_found!: the entity was not found and sort_by_match produced two or more (up to 5) close candidates, so the error lists them: 'TYPE `NAME` not found. Did you mean one of: A, B, C?'.","triggerScenarios":"IR lookup via error_not_found! when the bad name has multiple fuzzy matches among candidates, e.g. several similarly named classes/enums/functions.","commonSituations":"Ambiguous short names (e.g. 'Test' matching TestA/TestB); referencing by partial name expecting prefix matching; families of similarly named generated types.","solutions":["Pick the correct symbol from the suggested list and use its exact name","Use the fully qualified/unique name if several candidates share a prefix","Define the missing entity if none of the suggestions is what you meant"],"exampleFix":"// before\nfunction A() -> Podcst\n// error: ... Did you mean one of: Podcast, Podcasts, PodcastSh?\n// after\nfunction A() -> Podcast","handlingStrategy":"validation","validationCode":"if !symbols.contains(name) {\n  let suggestions = top_matches(name, symbols, 5);\n  eprintln!(\"{} not found; candidates: {:?}\", name, suggestions);\n}","typeGuard":"fn resolve_unique<'a>(name: &str, syms: &'a [String]) -> Option<&'a str> {\n  let m: Vec<&str> = syms.iter().map(|s| s.as_str()).filter(|s| *s == name).collect();\n  if m.len() == 1 { Some(m[0]) } else { None }\n}","tryCatchPattern":"match Err(e) if e.to_string().contains(\"Did you mean one of:\") => {\n  // choose among listed candidates\n}","preventionTips":["Give types distinct, non-prefix-overlapping names","Use fully qualified unique names in large schemas","Let the compiler's suggestions pick the intended symbol"],"tags":["baml","ir","not-found","typo-suggestion"],"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"}