{"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":"validation","errorClass":null,"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/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/update.rs#L136-L172","documentation":"The `but update` command validates a user-supplied version argument via `VersionRequest::from_string`. When the string is neither `nightly`, `release`, nor a parseable version, the underlying parse error is wrapped with this message listing the valid targets.","triggerScenarios":"Running `but update <version>` with a malformed version string — wrong separator (`0.18` is fine but `v0.18.7` with a `v` prefix or `0.18.x` may fail), misspelled keyword (`stable` instead of `release`), or an empty/garbage token.","commonSituations":"Typing `but update stable` or `but update latest` (unsupported keywords); copy-pasting a tag like `v0.18.7`; scripting with an unescaped variable that resolves to an unexpected string.","solutions":["Use one of the exact valid targets: `but update nightly`, `but update release`, or `but update 0.18.7` (bare semver, no `v` prefix).","Check the currently installed version with `but --version` and pick a matching format for the target version.","Run `but update` with no argument to auto-detect from the current channel instead of specifying a version."],"exampleFix":"// before\nbut update stable\n\n// after\nbut update release   # or: but update 0.18.7","handlingStrategy":"validation","validationCode":"// shell, before invoking\nVERSION=\"0.18.7\"\necho \"$VERSION\" | grep -Eq '^(nightly|release|[0-9]+\\.[0-9]+\\.[0-9]+)$' || { echo \"invalid target: $VERSION\"; exit 1; }","typeGuard":null,"tryCatchPattern":"match update(target) {\n    Err(e) if e.to_string().contains(\"Invalid version\") =>\n        eprintln!(\"Use nightly, release, or an x.y.z version\"),\n    other => other?,\n}","preventionTips":["Use exact keywords: `nightly` or `release` — not `stable`, `latest`, or `main`.","Pass bare semver without a `v` prefix (e.g., `0.18.7`).","Omit the argument entirely to auto-detect from the current channel."],"tags":["cli","version-parsing","validation"],"backgroundTag":"invalid-argument-value","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"}