{"record":{"id":"daa9dc6bd5d1f8df","repo":"gitbutlerapp/gitbutler","slug":"too-many-arguments-usage-but-installer-version","errorCode":null,"errorMessage":"Too many arguments. Usage: but-installer [version|nightly] or GITBUTLER_VERSION=<version> but-installer","messagePattern":"Too many arguments\\. Usage: but-installer \\[version\\|nightly\\] or GITBUTLER_VERSION=<version> but-installer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/config.rs","lineNumber":131,"sourceCode":"            }\n        }\n    }\n}\n\n/// Configuration for the installer\npub struct InstallerConfig {\n    pub version_request: VersionRequest,\n    pub home_dir: PathBuf,\n    pub platform: String,\n}\n\nimpl InstallerConfig {\n    /// Create a new installer config, reading version from command-line arguments or environment\n    pub fn new() -> Result<Self> {\n        // Validate argument count - only 0 or 1 positional arguments allowed\n        let args: Vec<String> = env::args().collect();\n        if args.len() > 2 {\n            bail!(\n                \"Too many arguments. Usage: but-installer [version|nightly] or GITBUTLER_VERSION=<version> but-installer\"\n            );\n        }\n\n        // Get version from CLI argument (takes precedence) or GITBUTLER_VERSION env var\n        let version_string = args\n            .get(1)\n            .cloned()\n            .or_else(|| env::var(\"GITBUTLER_VERSION\").ok());\n\n        let version_request = VersionRequest::from_string(version_string)?;\n        Self::new_with_version(version_request)\n    }\n\n    /// Create a new installer config with an explicit version request\n    pub(crate) fn new_with_version(version_request: VersionRequest) -> Result<Self> {\n        let home_dir =\n            dirs::home_dir().ok_or_else(|| anyhow!(\"Failed to determine home directory\"))?;","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/config.rs#L113-L149","documentation":"InstallerConfig::new enforces at most one positional argument: it collects env::args() and bails if more than two entries (program + one version) are present. The installer takes no options/flags, so any extra arguments (including unknown flags) produce this usage error.","triggerScenarios":"Running `but-installer 0.14.2 nightly`, `but-installer --verbose 0.14.2`, or passing extra shell-expanded tokens (unquoted globs matching multiple files).","commonSituations":"Users stacking flags from habit; scripts passing both a version and a channel; glob expansion in the working directory adding extra arguments (e.g. `but-installer *`).","solutions":["Invoke with at most one argument: `but-installer 0.14.2` or `but-installer nightly`.","Remove unknown flags — the installer supports no options; use env vars (GITBUTLER_VERSION) instead of flags.","Quote shell variables and avoid unquoted globs: `but-installer \"$VERSION\"`.","Set the channel via GITBUTLER_VERSION rather than a second positional argument."],"exampleFix":"// before\nbut-installer 0.14.2 nightly\n// after\nbut-installer nightly   # or: GITBUTLER_VERSION=0.14.2 but-installer","handlingStrategy":"validation","validationCode":"const ARGS: usize = std::env::args().count();\nassert!(ARGS <= 2, \"but-installer takes at most one version argument\");","typeGuard":null,"tryCatchPattern":"match InstallerConfig::new() {\n    Err(e) if e.to_string().contains(\"Too many arguments\") => {\n        eprintln!(\"{e}\");\n        std::process::exit(2);\n    }\n    Err(e) => return Err(e),\n    Ok(cfg) => run(cfg),\n}","preventionTips":["Invoke with at most one positional argument","Quote shell variables to prevent glob expansion adding arguments","Use GITBUTLER_VERSION env var for configuration instead of extra flags","Check `but-installer` docs — no flags are supported, so remove options like --verbose"],"tags":["installer","cli","argument-count","usage"],"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"}