{"record":{"id":"df9445d1bf76c611","repo":"xai-org/grok-build","slug":"failed-to-parse-versions-current-target","errorCode":null,"errorMessage":"Failed to parse versions (current={}, target={})","messagePattern":"Failed to parse versions \\(current=(.+?), target=(.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-update/src/auto_update.rs","lineNumber":2846,"sourceCode":"                    // and skips leaders already at/after this version).\n                    return Ok(Some(install_target));\n                }\n            }\n            None => {\n                // Distinguish parse failure from unsupported channel.\n                let parse_ok = semver::Version::parse(&effective_current).is_ok()\n                    && semver::Version::parse(&install_target).is_ok();\n                if parse_ok {\n                    anyhow::bail!(\n                        \"Unsupported release channel '{}' (current={}, target={}). \\\n                         Supported channels: stable, alpha, enterprise. \\\n                         Use --stable or --alpha to override, or set [cli] channel in config.toml.\",\n                        update_config.channel,\n                        effective_current,\n                        install_target\n                    );\n                } else {\n                    anyhow::bail!(\n                        \"Failed to parse versions (current={}, target={})\",\n                        effective_current,\n                        install_target\n                    );\n                }\n            }\n        }\n    }\n\n    let target_version = if force\n        && !needs_update(\n            &effective_current,\n            &install_target,\n            &update_config.channel,\n            installer_allows_downgrade(installer),\n        )\n        .unwrap_or(true)\n    {","sourceCodeStart":2828,"sourceCodeEnd":2864,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-update/src/auto_update.rs#L2828-L2864","documentation":"This is the fallback branch of the same check that produces the unsupported-channel error: both effective_current and install_target were attempted with semver::Version::parse and at least one failed. Because the versions themselves are unparseable, the updater cannot compute a channel-compatible plan and bails with the raw version strings.","triggerScenarios":"effective_current (installed Grok version string) or install_target is not valid semver — e.g. empty string, 'unknown', a version with non-numeric pre-release/build metadata, or output from `grok --version` in an unexpected format.","commonSituations":"Grok not installed so the detected version is empty/placeholder; a locally built binary reporting a non-semver version string (e.g. git describe output); corrupted install metadata; a target version typed with a typo (e.g. '1..2').","solutions":["Check the installed version output (`grok --version`) and reinstall Grok if it reports a non-semver or placeholder version","Correct the target version argument to valid semver (e.g. 1.2.3, optionally -alpha.1)","Ensure no environment or config is injecting an empty/invalid current-version string","If using a locally built binary, tag it with a proper semver version"],"exampleFix":"// before\nmy-updater --version v1.2   // 'v1.2' fails semver::Version::parse\n// after\nmy-updater --version 1.2.0  // valid semver\n# also ensure installed grok reports e.g. \"1.2.0\", not \"\" or \"unknown\"","handlingStrategy":"validation","validationCode":"fn is_valid_semver(v: &str) -> bool { semver::Version::parse(v).is_ok() }\nlet current = get_installed_grok_version();\nlet target = requested_target;\nif !is_valid_semver(&current) || !is_valid_semver(&target) {\n    eprintln!(\"Refusing update: non-semver version (current={current:?}, target={target:?})\");\n    std::process::exit(2);\n}","typeGuard":"fn as_semver(v: &str) -> Option<semver::Version> {\n    semver::Version::parse(v).ok()\n}","tryCatchPattern":"match run_update(target_opt).await {\n    Err(e) if e.to_string().starts_with(\"Failed to parse versions\") => {\n        // Re-detect the installed version or reinstall before retrying\n        reinstall_and_retry().await\n    }\n    other => other.map(|_| ())?,\n}","preventionTips":["Ensure `grok --version` (or the detection path) always yields plain semver, not git-describe or 'unknown'","Validate user-supplied --version strings with semver::Version::parse before invoking the updater","Reinstall Grok if the current-version detection returns empty or placeholder strings","Tag local builds with proper semver versions"],"tags":["semver","parsing","version-detection"],"backgroundTag":"invalid-semver-string","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}