{"record":{"id":"e1c8ef7a5b25bf4f","repo":"gitbutlerapp/gitbutler","slug":"invalid-version-format-version-version-must-co","errorCode":null,"errorMessage":"Invalid version format: {version}. Version must contain only alphanumeric characters, dots, hyphens, and plus signs.","messagePattern":"Invalid version format: (.+?)\\. Version must contain only alphanumeric characters, dots, hyphens, and plus signs\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-installer/src/config.rs","lineNumber":60,"sourceCode":"\n    /// Validate a version string format\n    fn validate(version: &str) -> Result<()> {\n        // Reject empty strings\n        if version.is_empty() {\n            bail!(\"Invalid version: empty string. Usage: but-installer [version|nightly]\");\n        }\n\n        // Reject if it looks like a flag\n        if version.starts_with('-') {\n            bail!(\"Invalid version: {version}. Usage: but-installer [version|nightly]\");\n        }\n\n        // Only allow semver-compatible characters\n        if !version\n            .chars()\n            .all(|c| c.is_alphanumeric() || c == '.' || c == '-' || c == '+')\n        {\n            bail!(\n                \"Invalid version format: {version}. Version must contain only alphanumeric characters, dots, hyphens, and plus signs.\"\n            );\n        }\n\n        // Must contain at least one alphanumeric character\n        if !version.chars().any(|c| c.is_alphanumeric()) {\n            bail!(\n                \"Invalid version format: {version}. Version must contain at least one alphanumeric character.\"\n            );\n        }\n\n        Ok(())\n    }\n\n    /// Get the version string as a &str\n    pub fn as_str(&self) -> &str {\n        &self.0\n    }","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-installer/src/config.rs#L42-L78","documentation":"validate enforces semver-compatible characters only: alphanumeric, '.', '-', '+'. A version containing spaces, slashes, underscores, parentheses, etc. bails with this message naming the offending input.","triggerScenarios":"Passing values like `0.14.2 (beta)`, `v0.14.2/fix`, `latest stable`, a full tag reference `refs/tags/0.14.2`, or a URL fragment as the version argument or GITBUTLER_VERSION.","commonSituations":"Scripts passing a git ref or release title instead of the tag name; copy-pasting from a browser with trailing whitespace or annotation text; using `v` prefix is fine, but adding labels like `stable` is not.","solutions":["Pass only the tag/version token, e.g. `0.14.2` or `v0.14.2` — strip any surrounding prose or refs prefix.","Trim whitespace in scripts: `VERSION=$(echo \"$VERSION\" | tr -d '[:space:]')`.","If deriving from `git describe`, drop decorators (`git describe --tags --abbrev=0`).","Use `nightly` when you want the rolling channel rather than a descriptive string."],"exampleFix":"// before\nbut-installer \"0.14.2 (beta)\"\n// after\nbut-installer 0.14.2-beta","handlingStrategy":"validation","validationCode":"fn is_semverish(v: &str) -> bool {\n    !v.is_empty() && v.chars().all(|c| c.is_alphanumeric() || matches!(c, '.' | '-' | '+'))\n}\nassert!(is_semverish(version), \"illegal characters in version: {version}\");","typeGuard":null,"tryCatchPattern":"match InstallerConfig::new() {\n    Err(e) if e.to_string().contains(\"only alphanumeric characters\") => {\n        eprintln!(\"{e}\\nPass a plain tag like 0.14.2, not a ref or description\");\n        std::process::exit(2);\n    }\n    Err(e) => return Err(e),\n    Ok(cfg) => run(cfg),\n}","preventionTips":["Pass only the bare tag token, not a git ref, URL, or release title","Trim whitespace from variables sourced from other tools","Convert spaces in labels to hyphens (0.14.2 beta -> 0.14.2-beta)","Validate with a semver regex before invoking the installer in scripts"],"tags":["installer","cli","validation","version","semver"],"backgroundTag":"invalid-argument-format","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"}