{"record":{"id":"927c8b94615dfaeb","repo":"jdx/mise","slug":"apk-info-failed","errorCode":null,"errorMessage":"apk info failed: {}","messagePattern":"apk info failed: (.+?)","errorType":"error_code","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/packages/apk.rs","lineNumber":95,"sourceCode":"        debug!(\"$ apk {}\", args.join(\" \"));\n        let output = tokio::process::Command::new(\"apk\")\n            .args(&args)\n            .stdin(Stdio::null())\n            .stdout(Stdio::piped())\n            .stderr(Stdio::piped())\n            .output()\n            .await?;\n        // apk info exits nonzero when any named package is not installed, but\n        // still prints installed package versions. Treat unexpected stderr as\n        // real apk failure instead of silently reporting everything missing.\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        if !output.status.success()\n            && !stderr.is_empty()\n            && !stderr\n                .lines()\n                .all(|l| l.trim().is_empty() || l.contains(\"not found\"))\n        {\n            bail!(\"apk info failed: {}\", stderr.trim());\n        }\n        let stdout = String::from_utf8_lossy(&output.stdout);\n        Ok(parse_apk_info(&stdout, pkgs))\n    }\n\n    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {\n        let mut args = vec![\"add\".to_string()];\n        if opts.update {\n            args.push(\"--update-cache\".to_string());\n        }\n        args.push(\"--\".to_string());\n        args.extend(pkgs.iter().map(apk_name));\n        if opts.dry_run {\n            miseprintln!(\"{}\", sudo::argv(\"apk\", &args).join(\" \"));\n            return Ok(());\n        }\n        sudo::run(\"apk\", &args, &[])\n    }","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/apk.rs#L77-L113","documentation":"The apk system package manager backend runs `apk info` to determine installed package states. If the command exits nonzero and stderr contains anything other than blank lines or 'not found' noise, mise surfaces the stderr verbatim as a failure of apk info.","triggerScenarios":"`apk info` exits nonzero with non-'not found' stderr — e.g. apk database locked, apk binary missing/broken, or apk reporting a real error.","commonSituations":"Running on an Alpine-ish system where apk is present but the world/database is corrupted or locked by another apk process; partially installed distro without a proper apk index.","solutions":["Read the stderr in the message to see apk's actual error","Fix the underlying apk issue (e.g. wait for a concurrent apk process, run `apk update`)","Verify apk works manually: apk info <package>","If mise should not manage packages via apk on this host, remove apk from the bootstrap package managers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"apk info --help >/dev/null 2>&1 || echo 'apk unavailable on this host'","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"apk info failed\") => fallback_to_manual_check(),\n    other => other?,\n}","preventionTips":["Ensure apk database is healthy (apk update succeeds) before bootstrap","Avoid running concurrent apk operations","Remove apk from bootstrap managers on non-Alpine hosts"],"tags":["apk","alpine","package-manager","command-failed"],"backgroundTag":"command-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}