{"record":{"id":"f83254c24e691b43","repo":"astrid-runtime/astrid","slug":"package-managed-method-has-an-update-command","errorCode":null,"errorMessage":"package-managed method has an update command","messagePattern":"package-managed method has an update command","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/self_update_notice.rs","lineNumber":155,"sourceCode":"    current: &semver::Version,\n    selected: &semver::Version,\n    selected_version: &str,\n) -> anyhow::Result<bool> {\n    if !method.manages_own_binary() {\n        return Ok(false);\n    }\n    if channel != UpdateChannel::Stable {\n        bail!(\n            \"{}-managed installs follow only stable; use a self-managed Astrid install for '{}'.\",\n            method.label(),\n            channel\n        );\n    }\n    if selected == current {\n        return Ok(false);\n    }\n    let how = managed_update_command(method, current, selected, selected_version)\n        .expect(\"package-managed method has an update command\");\n    let message = if selected < current {\n        format!(\n            \"The signed stable channel rolled back v{CURRENT_VERSION} → v{selected_version}. Apply the package-managed rollback with:\\n  {how}\"\n        )\n    } else {\n        format!(\n            \"Astrid was installed via {}. Update to signed stable v{selected_version} with:\\n  {how}\",\n            method.label()\n        )\n    };\n    println!(\n        \"{}\",\n        if selected < current {\n            Theme::warning(&message)\n        } else {\n            Theme::info(&message)\n        }\n    );","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/self_update_notice.rs#L137-L173","documentation":"run_self_update detects that the install method is package-managed and, when a different version is selected, builds the package-manager command via managed_update_command. For a managed method this mapping is expected to always succeed, so the result is unwrapped with expect; a None means the managed-channel table is missing an entry — an internal invariant violation. The panic fires while composing the rollback/upgrade notice message.","triggerScenarios":"Selecting a channel/version whose install method is package-managed but for which managed_update_command returns None; triggered from run_self_update when selected != current and the method→command mapping is incomplete (e.g. after adding a new package-manager method without updating the mapping).","commonSituations":"Installing via a package manager (deb/rpm/brew) and running the self-update check; developer added a new managed install method but forgot to extend managed_update_command; version rollback notices on signed stable channel with an unmapped method.","solutions":["Update managed_update_command to cover the package-managed method in question","Use the OS package manager directly (apt/dnf/brew) to upgrade/downgrade instead of the built-in self-update","Verify the detected install method is correct — a misdetection can select an unmapped method","File a bug with the install method and versions; this path should be unreachable"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// prefer the package manager directly when the install is package-managed\nif managed_channel_detected() {\n    run(\"apt-get install --only-upgrade astrid\")?; // or dnf/brew equivalent\n}","typeGuard":null,"tryCatchPattern":"match run_self_update(...) {\n    Err(e) | Panic if msg contains \"package-managed method has an update command\" =>\n        eprintln!(\"self-update unsupported for managed installs; use the OS package manager\"),\n    ok => ok?,\n}","preventionTips":["On package-managed installs, upgrade via apt/dnf/brew rather than self-update","Keep managed_update_command's method table in sync when adding install methods","Report unmapped managed methods as bugs — this branch should be unreachable"],"tags":["panic","invariant","self-update","package-manager"],"backgroundTag":"internal-invariant-violation","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}