can1357/oh-my-pi · error · Error

mise upgrade failed with exit code ${result.exitCode}

Error message

mise upgrade failed with exit code ${result.exitCode}

What it means

Thrown in updateViaMise when `mise upgrade <tool>` exits non-zero. mise's own error output is not included, so only the exit code is reported. The mise-managed tool version could not be upgraded.

Source

Thrown at packages/coding-agent/src/cli/update-cli.ts:1677

		throw new Error(`brew update failed with exit code ${update.exitCode}`);
	}

	console.log(chalk.dim("Updating via Homebrew..."));
	const args = buildHomebrewUpdateArgs(force);
	const result = await $`brew ${args}`.nothrow();
	if (result.exitCode !== 0) {
		throw new Error(`brew ${args[0]} failed with exit code ${result.exitCode}`);
	}

	await printVerification(expectedVersion);
}

async function updateViaMise(expectedVersion: string, force: boolean): Promise<void> {
	console.log(chalk.dim("Updating via mise..."));
	const args = buildMiseUpgradeArgs();
	const result = await $`mise ${args}`.nothrow();
	if (result.exitCode !== 0) {
		throw new Error(`mise upgrade failed with exit code ${result.exitCode}`);
	}

	if (force) {
		const forceArgs = buildMiseForceInstallArgs(expectedVersion);
		const forceResult = await $`mise ${forceArgs}`.nothrow();
		if (forceResult.exitCode !== 0) {
			throw new Error(`mise install --force failed with exit code ${forceResult.exitCode}`);
		}
	}

	await printVerification(expectedVersion);
}

// Monotonic within this process so two updates started in the same millisecond
// (same pid, same `Date.now()`) still get distinct temp/backup paths. Kept
// numeric so the artifact sweep's `\d+(\.\d+)*` matcher still reclaims them.
let updateAttemptSeq = 0;

View on GitHub (pinned to 9690622007)

Solutions

  1. Run `mise upgrade <tool> -v` (or the same args) manually to see mise's error
  2. Confirm the tool is mise-managed: `mise ls | grep <tool>`; if not, install it via mise first
  3. Update/rebuild the plugin (`mise plugin update <tool>`)
  4. Check network access to the release host the plugin downloads from
  5. Update manually with mise or switch to another install method

Example fix

// before
const result = await $`mise ${args}`.nothrow();
if (result.exitCode !== 0) {
	throw new Error(`mise upgrade failed with exit code ${result.exitCode}`);
}
// after
const result = await $`mise ${args}`.nothrow();
if (result.exitCode !== 0) {
	throw new Error(`mise upgrade failed (${result.exitCode}): ${result.stderr.text()}`);
}
Defensive patterns

Strategy: retry

Validate before calling

const managed = await $`mise ls ${tool}`.nothrow();
if (managed.exitCode !== 0) throw new Error(`${tool} is not managed by mise`);

Type guard

function miseUpgradeOk(r: { exitCode: number }): r is { exitCode: 0 } {
	return r.exitCode === 0;
}

Try / catch

try {
	await updateSelf({ method: "mise" });
} catch (err) {
	if (err.message.startsWith("mise upgrade failed")) {
		await $`mise plugin update ${tool}`.nothrow(); // refresh plugin, then retry
		await updateSelf({ method: "mise" });
	} else throw err;
}

Prevention

When it happens

Trigger: Self-update targets the mise method and `mise <upgrade args>` fails: tool/plugin not installed via mise, mise backend compile failure (cargo/go build plugins), or registry/network failure fetching the version.

Common situations: Tool was installed outside mise so mise can't manage it; mise plugin needs recompilation after toolchain changes; network blocked to GitHub releases; MISE_DATA_DIR permissions.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/c9903d593160b55d. Report an issue: GitHub.