{"record":{"id":"2d255127405aff1b","repo":"gitbutlerapp/gitbutler","slug":"invalid-version-version-str-e-valid-target","errorCode":null,"errorMessage":"Invalid version '{version_str}': {e}\n\nValid targets:\n  nightly          Install latest nightly build\n  release          Install latest stable release\n  <version>        Install specific version (e.g., 0.18.7)","messagePattern":"Invalid version '(.+?)': (.+?)\n\nValid targets:\n  nightly          Install latest nightly build\n  release          Install latest stable release\n  <version>        Install specific version \\(e\\.g\\., 0\\.18\\.7\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/command/update.rs","lineNumber":154,"sourceCode":"    // because the installer writes directly to stdout/stderr\n    if out.for_json().is_some() {\n        anyhow::bail!(\n            \"JSON output is not supported for 'but update install'.\\n\\n\\\n             The installation process requires interactive output.\\n\\\n             For automated installations, use the standalone installer:\\n\\\n             https://docs.gitbutler.com/installation\"\n        );\n    }\n\n    // Parse target to determine what to install\n    let version_request = match target.as_deref() {\n        Some(\"nightly\") => VersionRequest::Nightly,\n        Some(\"release\") => VersionRequest::Release,\n        Some(version_str) => {\n            // Specific version - validate and create\n            // Wrap validation errors with CLI-specific context\n            VersionRequest::from_string(Some(version_str.to_string())).map_err(|e| {\n                anyhow::anyhow!(\n                    \"Invalid version '{version_str}': {e}\\n\\nValid targets:\\n  nightly          Install latest nightly build\\n  release          Install latest stable release\\n  <version>        Install specific version (e.g., 0.18.7)\"\n                )\n            })?\n        }\n        None => {\n            // Auto-detect from current channel\n            let current_channel = but_path::AppChannel::new();\n            match current_channel {\n                but_path::AppChannel::Nightly => VersionRequest::Nightly,\n                but_path::AppChannel::Release => VersionRequest::Release,\n                but_path::AppChannel::Dev => VersionRequest::Release, // Dev installs release\n            }\n        }\n    };\n\n    // Call installer directly (handles all user-facing output)\n    // Don't print usage info since user is already using the CLI\n    but_installer::run_installation_with_version(version_request, false)?;","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/update.rs#L136-L172","documentation":"`but update <target>` accepts exactly three shapes: the literal 'nightly', the literal 'release', or a concrete version string that VersionRequest::from_string can parse. Anything else fails validation, and the error message lists the valid forms.","triggerScenarios":"`but update latest`, `but update stable`, `but update v0.18.7`, or a partial/malformed version string: all fail VersionRequest::from_string validation.","commonSituations":"Guessing the channel vocabulary ('stable' instead of 'release'), adding a 'v' prefix, or truncating the version number.","solutions":["Use a channel: `but update nightly` or `but update release`","Use a full concrete version as printed by releases, e.g. `but update 0.18.7`","Omit the argument to auto-detect from the current channel (nightly upgrades to nightly; release and dev go to release)"],"exampleFix":"# before\nbut update latest   # invalid target\n# after\nbut update release","handlingStrategy":"validation","validationCode":"fn is_valid_target(t: &str) -> bool {\n    t == \"nightly\"\n        || t == \"release\"\n        || VersionRequest::from_string(Some(t.to_string())).is_ok()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin scripts to 'nightly', 'release', or exact released version numbers","Re-check `but update --help` after upgrading but"],"tags":["update","version","cli","argument-validation"],"backgroundTag":"invalid-version-string","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}