{"record":{"id":"223783fbb2bf9ed0","repo":"BoundaryML/baml","slug":"function-func-not-found-did-you-mean-one-of","errorCode":null,"errorMessage":"function `{func}` not found. Did you mean one of:\n{}","messagePattern":"function `(.+?)` not found\\. Did you mean one of:\n(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/pack_command.rs","lineNumber":454,"sourceCode":"                    )\n                });\n        }\n        crate::project_load::resolve_project_name(self.from.as_deref())\n    }\n}\n\n/// Resolve a single function-name string against the engine; returns\n/// canonical qualified/display/subcommand-name triple.\nfn resolve_one(engine: &BexEngine, func: &str) -> Result<ResolvedPackTarget> {\n    if !engine.function_exists(func) {\n        let suggestions = function_suggestions(engine, func);\n        if suggestions.is_empty() {\n            anyhow::bail!(\n                \"function `{func}` not found. Use `baml run --list` to see \\\n                 available targets.\"\n            );\n        }\n        anyhow::bail!(\n            \"function `{func}` not found. Did you mean one of:\\n{}\",\n            suggestions\n                .iter()\n                .map(|s| format!(\"  - {s}\"))\n                .collect::<Vec<_>>()\n                .join(\"\\n\")\n        );\n    }\n    let qualified_name = canonicalize_function_name(engine, func);\n    let display_name = qualified_name\n        .strip_prefix(\"user.\")\n        .unwrap_or(&qualified_name)\n        .to_string();\n    let subcommand_name = display_name\n        .rsplit('.')\n        .next()\n        .unwrap_or(&display_name)\n        .to_string();","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/pack_command.rs#L436-L472","documentation":"The sibling of error 107 in resolve_one: when the requested function does not exist but similar user functions DO exist, the CLI bails with a not-found message plus a ranked list of suggestions (`  - name` lines). Suggestions are ranked by substring containment first, then jaro-winkler similarity.","triggerScenarios":"Running `baml pack <TARGET>` or `baml pack -f <NAME>` with a misspelled or partially-typed function name that closely resembles existing functions.","commonSituations":"Typos like `Gret` for `Greet`; abbreviated names; casing mistakes (`greet` vs `Greet`); remembering an old name after a refactor.","solutions":["Re-run with one of the suggested names from the `Did you mean one of:` list.","Run `baml run --list` for the full set of valid targets.","Use the fully qualified name if multiple modules define similar functions."],"exampleFix":"// before\nbaml pack -f Gret\n// error suggests: Greet\n\n// after\nbaml pack -f Greet","handlingStrategy":"validation","validationCode":"# exact-match against the list before invoking; accept the CLI's suggestion otherwise\nbaml run --list | grep -Fxq \"$FUNC\" || { echo \"not found; check suggestions via baml pack -f output\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":"// accept the first \"Did you mean\" suggestion automatically\nif let Err(e) = pack(func) {\n    if let Some(sug) = parse_first_suggestion(&e.to_string()) {\n        pack(&sug)?;\n    } else { return Err(e); }\n}","preventionTips":["Copy function names from `baml run --list` output rather than retyping them.","Watch casing — BAML function names are case-sensitive.","Re-check names after refactors that rename functions."],"tags":["cli","function-not-found","did-you-mean","baml-pack"],"backgroundTag":"resource-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"}