astrid-runtime/astrid · error

package-managed method has an update command

Error message

package-managed method has an update command

What it means

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.

Solutions

  1. Update managed_update_command to cover the package-managed method in question
  2. Use the OS package manager directly (apt/dnf/brew) to upgrade/downgrade instead of the built-in self-update
  3. Verify the detected install method is correct — a misdetection can select an unmapped method
  4. File a bug with the install method and versions; this path should be unreachable
Defensive patterns

Strategy: try-catch

Validate before calling

// prefer the package manager directly when the install is package-managed
if managed_channel_detected() {
    run("apt-get install --only-upgrade astrid")?; // or dnf/brew equivalent
}

Try / catch

match run_self_update(...) {
    Err(e) | Panic if msg contains "package-managed method has an update command" =>
        eprintln!("self-update unsupported for managed installs; use the OS package manager"),
    ok => ok?,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/f83254c24e691b43. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-cli/src/commands/self_update_notice.rs:155

    current: &semver::Version,
    selected: &semver::Version,
    selected_version: &str,
) -> anyhow::Result<bool> {
    if !method.manages_own_binary() {
        return Ok(false);
    }
    if channel != UpdateChannel::Stable {
        bail!(
            "{}-managed installs follow only stable; use a self-managed Astrid install for '{}'.",
            method.label(),
            channel
        );
    }
    if selected == current {
        return Ok(false);
    }
    let how = managed_update_command(method, current, selected, selected_version)
        .expect("package-managed method has an update command");
    let message = if selected < current {
        format!(
            "The signed stable channel rolled back v{CURRENT_VERSION} → v{selected_version}. Apply the package-managed rollback with:\n  {how}"
        )
    } else {
        format!(
            "Astrid was installed via {}. Update to signed stable v{selected_version} with:\n  {how}",
            method.label()
        )
    };
    println!(
        "{}",
        if selected < current {
            Theme::warning(&message)
        } else {
            Theme::info(&message)
        }
    );

View on GitHub (pinned to affd8760f4)