{"record":{"id":"dea7e872e733a66c","repo":"BoundaryML/baml","slug":"function-func-not-found-use-baml-run-list-to-see-available","errorCode":null,"errorMessage":"function `{func}` not found. Use `baml run --list` to see available targets.","messagePattern":"function `(.+?)` not found\\. Use `baml run --list` to see available targets\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/pack_command.rs","lineNumber":449,"sourceCode":"                .map(str::to_string)\n                .ok_or_else(|| {\n                    anyhow::anyhow!(\n                        \"cannot derive an output name from `{}`; pass `-o <PATH>` to name the output.\",\n                        file.display()\n                    )\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();","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/pack_command.rs#L431-L467","documentation":"resolve_one looks a requested function name up against the loaded engine (engine.function_exists). When the name does not exist AND no similar names can be suggested (function_suggestions returned empty), the CLI bails with a plain not-found message pointing at `baml run --list`. This is the no-suggestion variant of the unknown-function error.","triggerScenarios":"Running `baml pack <TARGET>` or `baml pack -f <NAME>` where the name matches no function in the project and is not similar to any existing one (so the suggestion list is empty).","commonSituations":"Typos with no close match; targeting a function defined in another project or branch; the function was deleted or renamed; running from a directory whose project doesn't include the function.","solutions":["Run `baml run --list` to see the available target names and use one verbatim.","Check spelling/casing, including the full qualified name (e.g. `module.Function`).","Verify you're in (or passing `--from`) the project that actually defines the function."],"exampleFix":"// before\nbaml pack -f MyFunciton\n\n// after (check real name first)\nbaml run --list\nbaml pack -f MyFunction","handlingStrategy":"validation","validationCode":"# verify the function exists before packing\nbaml run --list | grep -Fxq \"$FUNC\" || { echo \"unknown function: $FUNC\" >&2; exit 2; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Look up exact names with `baml run --list` instead of typing from memory.","Use fully qualified names when multiple modules define functions.","Update scripts after renaming or deleting functions."],"tags":["cli","function-not-found","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"}