{"record":{"id":"31fb5f2d3e7d8793","repo":"gitbutlerapp/gitbutler","slug":"unknown-argument-other","errorCode":null,"errorMessage":"Unknown argument: {other}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-ts/src/main.rs","lineNumber":544,"sourceCode":"            \"--source-crates\" => {\n                let val = args.next().ok_or_else(|| {\n                    anyhow::anyhow!(\n                        \"--source-crates requires a comma-separated list of crate prefixes\"\n                    )\n                })?;\n                source_crates.extend(\n                    val.split(',')\n                        .map(|s| s.trim())\n                        .filter(|s| !s.is_empty())\n                        .map(str::to_string),\n                );\n            }\n            \"--help\" | \"-h\" => {\n                eprintln!(\"Usage: but-ts --output <path> [--source-crates <crate1,crate2,...>]\");\n                std::process::exit(0);\n            }\n            other => {\n                anyhow::bail!(\"Unknown argument: {other}\");\n            }\n        }\n    }\n    Ok(Args {\n        output: output.ok_or_else(|| anyhow::anyhow!(\"--output is required\"))?,\n        source_crates,\n    })\n}\n\n/// Returns true if the property schema is nullable (its TS type includes `| null`).\nfn is_nullable(schema: &serde_json::Value) -> bool {\n    let Some(obj) = schema.as_object() else {\n        return false;\n    };\n    // anyOf: [..., { \"type\": \"null\" }]  — used for nullable struct/enum types\n    if let Some(arr) = obj.get(\"anyOf\").and_then(|v| v.as_array()) {\n        return arr.iter().any(|s| {\n            s.as_object()","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-ts/src/main.rs#L526-L562","documentation":"`parse_args` in the but-ts CLI rejects any command-line argument it does not recognize with `bail!(\"Unknown argument: {other}\")`. The generator only accepts `--output`, `--source-crates`, and `--help`; anything else is a hard failure before generation starts.","triggerScenarios":"Running `but-ts` with a mistyped or unsupported flag, e.g. `but-ts --out path` or `but-ts --output=path extra-flag`, or passing a positional argument the parser does not handle.","commonSituations":"Copy-pasting invocation examples from older docs or scripts; typo in `--output`/`--source-crates`; passing flags meant for other codegen tools (e.g. `--out-dir`).","solutions":["Run `but-ts --help` to list the accepted flags (`--output <path> [--source-crates <crate1,crate2,...>])`.","Fix the typo in the flag name (e.g. `--out` → `--output`).","Remove any positional/extra arguments that the current but-ts version does not support."],"exampleFix":"// before\nbut-ts --out-dir ../sdk/src/types\n// after\nbut-ts --output ../sdk/src/types.ts --source-crates but-core,but-workspace","handlingStrategy":"validation","validationCode":"const ALLOWED: &[&str] = &[\"--output\", \"--source-crates\", \"--help\"];\nfor a in std::env::args().skip(1) {\n    assert!(ALLOWED.iter().any(|f| a.starts_with(f)), \"unsupported flag: {a}\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `but-ts --help` before scripting invocations.","Store the canonical invocation in a justfile/Makefile target instead of ad-hoc commands.","Avoid copy-pasting flags from other codegen tools."],"tags":["cli","argument-parsing","codegen"],"backgroundTag":"invalid-cli-argument","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}