{"record":{"id":"c9903d593160b55d","repo":"can1357/oh-my-pi","slug":"mise-upgrade-failed-with-exit-code-result-exitco","errorCode":null,"errorMessage":"mise upgrade failed with exit code ${result.exitCode}","messagePattern":"mise upgrade failed with exit code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/update-cli.ts","lineNumber":1677,"sourceCode":"\t\tthrow new Error(`brew update failed with exit code ${update.exitCode}`);\n\t}\n\n\tconsole.log(chalk.dim(\"Updating via Homebrew...\"));\n\tconst args = buildHomebrewUpdateArgs(force);\n\tconst result = await $`brew ${args}`.nothrow();\n\tif (result.exitCode !== 0) {\n\t\tthrow new Error(`brew ${args[0]} failed with exit code ${result.exitCode}`);\n\t}\n\n\tawait printVerification(expectedVersion);\n}\n\nasync function updateViaMise(expectedVersion: string, force: boolean): Promise<void> {\n\tconsole.log(chalk.dim(\"Updating via mise...\"));\n\tconst args = buildMiseUpgradeArgs();\n\tconst result = await $`mise ${args}`.nothrow();\n\tif (result.exitCode !== 0) {\n\t\tthrow new Error(`mise upgrade failed with exit code ${result.exitCode}`);\n\t}\n\n\tif (force) {\n\t\tconst forceArgs = buildMiseForceInstallArgs(expectedVersion);\n\t\tconst forceResult = await $`mise ${forceArgs}`.nothrow();\n\t\tif (forceResult.exitCode !== 0) {\n\t\t\tthrow new Error(`mise install --force failed with exit code ${forceResult.exitCode}`);\n\t\t}\n\t}\n\n\tawait printVerification(expectedVersion);\n}\n\n// Monotonic within this process so two updates started in the same millisecond\n// (same pid, same `Date.now()`) still get distinct temp/backup paths. Kept\n// numeric so the artifact sweep's `\\d+(\\.\\d+)*` matcher still reclaims them.\nlet updateAttemptSeq = 0;\n","sourceCodeStart":1659,"sourceCodeEnd":1695,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/update-cli.ts#L1659-L1695","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `mise upgrade <tool> -v` (or the same args) manually to see mise's error","Confirm the tool is mise-managed: `mise ls | grep <tool>`; if not, install it via mise first","Update/rebuild the plugin (`mise plugin update <tool>`)","Check network access to the release host the plugin downloads from","Update manually with mise or switch to another install method"],"exampleFix":"// before\nconst result = await $`mise ${args}`.nothrow();\nif (result.exitCode !== 0) {\n\tthrow new Error(`mise upgrade failed with exit code ${result.exitCode}`);\n}\n// after\nconst result = await $`mise ${args}`.nothrow();\nif (result.exitCode !== 0) {\n\tthrow new Error(`mise upgrade failed (${result.exitCode}): ${result.stderr.text()}`);\n}","handlingStrategy":"retry","validationCode":"const managed = await $`mise ls ${tool}`.nothrow();\nif (managed.exitCode !== 0) throw new Error(`${tool} is not managed by mise`);","typeGuard":"function miseUpgradeOk(r: { exitCode: number }): r is { exitCode: 0 } {\n\treturn r.exitCode === 0;\n}","tryCatchPattern":"try {\n\tawait updateSelf({ method: \"mise\" });\n} catch (err) {\n\tif (err.message.startsWith(\"mise upgrade failed\")) {\n\t\tawait $`mise plugin update ${tool}`.nothrow(); // refresh plugin, then retry\n\t\tawait updateSelf({ method: \"mise\" });\n\t} else throw err;\n}","preventionTips":["Install the tool through mise so mise can upgrade it","Keep mise plugins updated (`mise plugin update --all`)","Ensure MISE_DATA_DIR is writable and release hosts are reachable"],"tags":["mise","self-update","upgrade","process-exit-code"],"backgroundTag":"package-install-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}