{"record":{"id":"0e43d7e2f8b4c757","repo":"BoundaryML/baml","slug":"not-found-did-you-mean","errorCode":null,"errorMessage":"{} `{}` not found. Did you mean: {}?","messagePattern":"(.+?) `(.+?)` not found\\. Did you mean: (.+?)\\?","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-lib/baml-core/src/ir/ir_helpers/error_utils.rs","lineNumber":61,"sourceCode":"        .filter(|&&(dist, _)| dist <= THRESHOLD)\n        .map(|&(_, idx)| options.index(idx).as_ref());\n\n    // Return either a limited or full set of filtered names\n    match max_return {\n        Some(max) => filtered_names.take(max).collect(),\n        None => filtered_names.collect(),\n    }\n}\n\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}","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-lib/baml-core/src/ir/ir_helpers/error_utils.rs#L43-L79","documentation":"Single-suggestion arm of error_not_found!: the referenced entity was not found, but sort_by_match found exactly one close candidate. The full message is 'TYPE `NAME` not found. Did you mean: CANDIDATE?' telling the developer the likely intended symbol.","triggerScenarios":"IR lookup via error_not_found! where the misspelled name has exactly one fuzzy match among the candidate definitions (similarity above cutoff, others below).","commonSituations":"Small typos like wrong capitalization or a singular/plural mismatch (e.g. 'User' vs 'Users'); autocomplete picking a stale name after a rename.","solutions":["Use the suggested name from the error message in your .baml file","Rename the definition if the intended symbol was renamed","Verify the referenced symbol exists with the exact spelling"],"exampleFix":"// before\nfunction A() -> userr\n// error: class `userr` not found. Did you mean: User?\n// after\nfunction A() -> User","handlingStrategy":"validation","validationCode":"if !symbols.contains(name) {\n  let best = closest_match(name, symbols);\n  eprintln!(\"{} not found; did you mean {:?}?\", name, best);\n}","typeGuard":"fn exact_or_suggestion<'a>(name: &str, syms: &'a [String]) -> Option<&'a str> {\n  syms.iter().find(|s| s.as_str() == name).map(|s| s.as_str())\n}","tryCatchPattern":"match Err(e) if e.to_string().contains(\"Did you mean:\") => {\n  // apply the suggested name from the message\n}","preventionTips":["Read the 'Did you mean' hint and use the exact suggested spelling","Enable the BAML language server for real-time diagnostics","Rename via tooling (find/replace across .baml) rather than by hand"],"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-14T05:17:10.506Z"}