{"record":{"id":"0145374a36eac0ab","repo":"BoundaryML/baml","slug":"no-baml-toml-found-from-up-to-the-home-directory-run-this","errorCode":null,"errorMessage":"no baml.toml found from {} up to the home directory\nRun this command inside a BAML project.","messagePattern":"no baml\\.toml found from (.+?) up to the home directory\nRun this command inside a BAML project\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml/src/main.rs","lineNumber":1283,"sourceCode":"        }\n    }\n    Ok(selector)\n}\n\nfn use_toolchain(selector: &str, override_url: Option<&str>) -> Result<()> {\n    let selector = prepare_toolchain_selector(selector, &env::current_dir()?, override_url)?;\n\n    let mut config = read_config();\n    config.default.selector.clone_from(&selector);\n    write_config(&config)?;\n    println!(\"selected BAML toolchain {selector}\");\n    Ok(())\n}\n\nfn pin_toolchain(selector: &str, override_url: Option<&str>) -> Result<()> {\n    let cwd = env::current_dir()?;\n    let manifest_path = find_project_manifest(&cwd).ok_or_else(|| {\n        anyhow!(\n            \"no baml.toml found from {} up to the home directory\\nRun this command inside a BAML project.\",\n            cwd.display()\n        )\n    })?;\n    let content = fs::read_to_string(&manifest_path)\n        .with_context(|| format!(\"failed to read {}\", manifest_path.display()))?;\n    let normalized_selector = normalize_selector(selector, &cwd);\n    let selector_key = if is_channel(&normalized_selector) {\n        \"channel\"\n    } else if is_path_selector(&normalized_selector) {\n        \"path\"\n    } else {\n        \"version\"\n    };\n    let updated = pin_selector_in_manifest(&content, selector_key, &normalized_selector)\n        .with_context(|| format!(\"failed to update {}\", manifest_path.display()))?;\n\n    let selector = prepare_toolchain_selector(&normalized_selector, &cwd, override_url)?;","sourceCodeStart":1265,"sourceCodeEnd":1301,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml/src/main.rs#L1265-L1301","documentation":"pin_toolchain records the selected toolchain in the nearest baml.toml. It walks from the current directory up to the home directory via find_project_manifest; if no manifest is found, this error tells the user to run the command inside a BAML project, since pinning is meaningless without one.","triggerScenarios":"Running `baml toolchain use <selector>` (pin_toolchain) from a directory outside any BAML project — find_project_manifest(&cwd) returns None because no baml.toml exists in cwd or any ancestor up to the home directory.","commonSituations":"Running the command in a scratch/home directory; a project missing its baml.toml (deleted or never committed); being one directory too deep outside the repo.","solutions":["cd into your BAML project directory (one containing baml.toml) and re-run the command.","Create a baml.toml in the project root if the project has none.","Set a global/default toolchain instead if you intentionally have no project here."],"exampleFix":"// before\ncd ~ && baml toolchain use canary   // no baml.toml anywhere up the tree\n// after\ncd ~/my-baml-project   // contains baml.toml\nbaml toolchain use canary","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport { resolve, dirname, join } from 'path';\nfunction findBamlToml(dir: string): string | null {\n  let d = resolve(dir);\n  while (true) {\n    if (existsSync(join(d, 'baml.toml'))) return join(d, 'baml.toml');\n    const parent = dirname(d);\n    if (parent === d) return null;\n    d = parent;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  execFileSync('baml', ['toolchain', 'use', version]);\n} catch (e) {\n  if (/no baml.toml found/.test(e.stderr?.toString() ?? '')) {\n    console.error('Run this command inside a BAML project directory.');\n  }\n}","preventionTips":["Always cd into the project root (the directory containing baml.toml) before toolchain commands.","Commit baml.toml so clones always have a manifest.","In CI, set working-directory to the project folder."],"tags":["cli","toolchain","manifest","project"],"backgroundTag":"config-file-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"}