{"record":{"id":"e7e4a343ec2cdfca","repo":"can1357/oh-my-pi","slug":"mise-install-force-failed-with-exit-code-force","errorCode":null,"errorMessage":"mise install --force failed with exit code ${forceResult.exitCode}","messagePattern":"mise install --force failed with exit code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/update-cli.ts","lineNumber":1684,"sourceCode":"\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\n/**\n * Download a release binary to a target path, replacing an existing file.\n */\nexport async function updateViaBinaryAt(\n\ttargetPath: string,\n\texpectedVersion: string,\n\toptions: {","sourceCodeStart":1666,"sourceCodeEnd":1702,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/update-cli.ts#L1666-L1702","documentation":"Thrown in updateViaMise when the `--force` path is requested and the follow-up forced install (`mise install --force ...` via buildMiseForceInstallArgs) exits non-zero. This runs only when force is set, after a successful `mise upgrade`, to guarantee the exact expected version is installed.","triggerScenarios":"User runs self-update with --force on a mise install and `mise <force-install args>` fails — the target version is not available for the platform, source build fails, or the tool prefix directory is not writable.","commonSituations":"Expected version not published for the current OS/arch; corrupted mise installs directory (~/.local/share/mise); plugin compile failure on forced reinstall.","solutions":["Run the forced install manually to see mise's error output","Check the version exists for your platform (`mise ls-remote <tool>`)","Clear the mise installs cache for the tool and retry","Fix permissions on MISE_DATA_DIR/installs directory","Drop --force and retry a normal `mise upgrade`"],"exampleFix":"// before\nconst forceResult = await $`mise ${forceArgs}`.nothrow();\nif (forceResult.exitCode !== 0) {\n\tthrow new Error(`mise install --force failed with exit code ${forceResult.exitCode}`);\n}\n// after\nconst forceResult = await $`mise ${forceArgs}`.nothrow();\nif (forceResult.exitCode !== 0) {\n\tthrow new Error(`mise install --force failed (${forceResult.exitCode}): ${forceResult.stderr.text()}`);\n}","handlingStrategy":"validation","validationCode":"const remote = await $`mise ls-remote ${tool}`.nothrow();\nif (!remote.text().split(\"\\n\").includes(expectedVersion)) {\n\tthrow new Error(`${expectedVersion} not available for mise install --force`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the exact version exists for your platform before using --force","Avoid --force on machines with restricted networks or slow build toolchains","Keep the mise installs directory free of permission issues"],"tags":["mise","self-update","force-install","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"}