{"record":{"id":"a45b4e0295ee5a8d","repo":"Hmbown/CodeWhale","slug":"codewhale-providers-export-requires-json","errorCode":null,"errorMessage":"`codewhale providers export` requires `--json`","messagePattern":"`codewhale providers export` requires `--json`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":5497,"sourceCode":"    }\n    if let Some(base_url) = cli.base_url.as_ref() {\n        set_tui_env(\"CODEWHALE_BASE_URL\", base_url);\n        set_tui_env(\"DEEPSEEK_BASE_URL\", base_url);\n    }\n}\n\n// There is deliberately no \"just run the TUI with these args\" helper here. One\n// existed, `thread resume`/`thread fork` used it, and it forwarded neither\n// `--config` nor the resolved telemetry value — so the kill switch the\n// dispatcher had already applied never reached the process that emits. Every\n// delegation is now in-process, and\n// `only_one_function_may_locate_and_spawn_the_tui` pins that.\n\nfn run_providers_command(args: ProvidersArgs) -> Result<()> {\n    match args.command {\n        ProvidersCommand::Export { json } => {\n            if !json {\n                bail!(\"`codewhale providers export` requires `--json`\");\n            }\n            let export = ProvidersExport::from_registry(env!(\"CODEWHALE_BUILD_VERSION\"));\n            serde_json::to_writer_pretty(io::stdout(), &export)\n                .context(\"failed to write providers export\")?;\n            println!();\n            Ok(())\n        }\n    }\n}\n\nfn run_metrics_command(args: MetricsArgs) -> Result<()> {\n    let since = match args.since.as_deref() {\n        Some(s) => {\n            Some(metrics::parse_since(s).with_context(|| format!(\"invalid --since value: {s:?}\"))?)\n        }\n        None => None,\n    };\n    metrics::run(metrics::MetricsArgs {","sourceCodeStart":5479,"sourceCodeEnd":5515,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/lib.rs#L5479-L5515","documentation":"`providers export` only supports machine-readable JSON output; invoking it without --json is rejected because the export path has no human-readable rendering, so the missing flag is an invalid usage rather than a formatting choice.","triggerScenarios":"Running `codewhale providers export` without the `--json` flag.","commonSituations":"Older workflow or doc example predating the flag requirement; user expecting a human-readable table format; shell alias dropping flags.","solutions":["Add the flag: `codewhale providers export --json`.","Pipe into jq or a file for consumption: `codewhale providers export --json > providers.json`.","Check `codewhale providers export --help` for the current required flags."],"exampleFix":"// before\ncodewhale providers export\n// after\ncodewhale providers export --json","handlingStrategy":"validation","validationCode":"// shell-side guard\n[[ \" $* \" == *\" --json \"* ]] || { echo 'providers export requires --json'; exit 2; }","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_providers_command(args) {\n    if e.to_string().contains(\"requires `--json`\") {\n        eprintln!(\"re-run as: codewhale providers export --json\");\n    } else { return Err(e); }\n}","preventionTips":["Always pass --json to providers export; there is no plain-text mode.","Update internal docs/scripts that predate the flag requirement.","Parse the JSON output with jq or serde rather than scraping text."],"tags":["cli","providers","flag"],"backgroundTag":"missing-required-flag","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}