{"record":{"id":"da6e9be76f2ebf73","repo":"BoundaryML/baml","slug":"manifest-base-url-requires-a-value","errorCode":null,"errorMessage":"--manifest-base-url requires a value","messagePattern":"--manifest-base-url requires a value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml/src/main.rs","lineNumber":409,"sourceCode":"        }\n        Some(other) => Err(anyhow!(\n            \"unknown toolchain command {other:?}\\n\\n{TOOLCHAIN_HELP}\"\n        )),\n    }\n}\n\nfn is_help_arg(arg: &str) -> bool {\n    matches!(arg, \"--help\" | \"-h\" | \"help\")\n}\n\nfn parse_manifest_base_url(mut args: Vec<String>) -> Result<(Vec<String>, Option<String>)> {\n    let mut manifest_base_url = None;\n    let mut i = 0;\n    while i < args.len() {\n        if args[i] == \"--manifest-base-url\" {\n            let value = args\n                .get(i + 1)\n                .ok_or_else(|| anyhow!(\"--manifest-base-url requires a value\"))?\n                .trim_end_matches('/')\n                .to_string();\n            args.drain(i..=i + 1);\n            manifest_base_url = Some(value);\n        } else {\n            i += 1;\n        }\n    }\n    Ok((args, manifest_base_url))\n}\n\nfn pass_through(args: Vec<String>) -> Result<i32> {\n    let selector = active_selector()?;\n    if let Some(cli) = path_selector(&selector.selector) {\n        return exec_path_toolchain(cli, &selector, args);\n    }\n    let version = concrete_version_for_selector(&selector)?;\n    let cli = toolchain_cli_path(&version);","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml/src/main.rs#L391-L427","documentation":"The `--manifest-base-url` flag used by `baml toolchain` subcommands consumes the next argument as its value. When the flag is the last argument and nothing follows it, `parse_manifest_base_url` throws this error instead of silently treating the missing URL as an empty string.","triggerScenarios":"Running e.g. `baml toolchain install nightly --manifest-base-url` with no value after the flag.","commonSituations":"Shell scripts where the URL variable is empty or unset (`--manifest-base-url $URL` expanding to nothing), copy-paste dropping the URL, or line-wrapped commands losing the last token.","solutions":["Append the URL value: `--manifest-base-url https://example.com/manifests/` (trailing slashes are trimmed automatically).","Quote the variable and verify it is non-empty before invoking: `[ -n \"$URL\" ]`.","Omit the flag entirely if you want the default manifest source."],"exampleFix":"# before\nURL=\"\"\nbaml toolchain install nightly --manifest-base-url $URL\n\n# after\nURL=\"https://mirrors.example.com/baml\"\nbaml toolchain install nightly --manifest-base-url \"$URL\"","handlingStrategy":"validation","validationCode":"URL=\"${MANIFEST_BASE_URL:-}\"\ncmd=(baml toolchain install nightly)\nif [ -n \"$URL\" ]; then\n  [ \"$URL\" = \"${URL#-}\" ] || { echo \"bad URL\" >&2; exit 1; }\n  cmd+=(--manifest-base-url \"$URL\")\nfi\n\"${cmd[@]}\"","typeGuard":"function hasFlagValue(args: string[], flag: string): boolean {\n  const i = args.indexOf(flag);\n  return i !== -1 && i + 1 < args.length && args[i + 1].length > 0;\n}","tryCatchPattern":"try:\n    subprocess.run(cmd, check=True)\nexcept subprocess.CalledProcessError as e:\n    if \"--manifest-base-url requires a value\" in e.stderr.decode():\n        raise SystemExit(\"--manifest-base-url was given without a URL\")","preventionTips":["Always place the URL immediately after --manifest-base-url, never let it end a command line.","Quote variables: `--manifest-base-url \"$URL\"` so empty values are visible failures.","Omit the flag entirely when no custom manifest source is needed."],"tags":["cli","usage","flag-value","toolchain"],"backgroundTag":"missing-required-flag","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}