{"record":{"id":"b211acf96815d2d7","repo":"jdx/mise","slug":"apt-cache-not-found","errorCode":null,"errorMessage":"apt-cache not found","messagePattern":"apt-cache not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/deps.rs","lineNumber":877,"sourceCode":"        #[async_trait::async_trait(?Send)]\n        impl SystemPackageManager for CannotAnswer {\n            fn name(&self) -> &str {\n                \"stub\"\n            }\n            fn is_available(&self) -> bool {\n                true\n            }\n            fn unavailable_reason(&self) -> String {\n                unreachable!()\n            }\n            async fn installed(\n                &self,\n                _pkgs: &[PackageRequest],\n            ) -> crate::result::Result<Vec<crate::system::packages::PackageStatus>> {\n                Ok(vec![])\n            }\n            async fn available(&self, _names: &[String]) -> crate::result::Result<Vec<bool>> {\n                eyre::bail!(\"apt-cache not found\")\n            }\n            async fn install(\n                &self,\n                _pkgs: &[PackageRequest],\n                _opts: &crate::system::packages::InstallOpts,\n            ) -> crate::result::Result<()> {\n                Ok(())\n            }\n        }\n        let m: Arc<dyn SystemPackageManager> = Arc::new(CannotAnswer);\n        let dep = dep_with_packages(vec![\"libaio1t64\", \"libaio1\"]);\n        assert_eq!(\n            resolve_package(&m, &dep).await.as_deref(),\n            Some(\"libaio1t64\")\n        );\n    }\n\n    #[test]","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/deps.rs#L859-L895","documentation":"The apt-based package provider's `available` check is hard-coded to fail with \"apt-cache not found\" when the `apt-cache` binary cannot be used, so the provider cannot answer whether package names exist in the APT index.","triggerScenarios":"Calling `available(&names)` on the apt provider on a system where `apt-cache` is not installed or not on PATH — i.e. a Debian-family tool layout is assumed but missing (or the code path is exercised on a non-Debian test backend).","commonSituations":"Running system-package management on a non-Debian Linux (Fedora, Arch) or macOS where apt isn't present; a minimal container image (debian-slim variants) without apt-utils/apt-cache; PATH stripped in CI so the binary isn't found.","solutions":["Install apt (and apt-utils) so `apt-cache` is on PATH: `apt-get update && apt-get install -y apt-utils`.","Use the appropriate package provider for your distro (dnf/pacman/brew) instead of the apt provider.","Fix PATH in the environment (especially CI) so /usr/bin is included and `which apt-cache` succeeds."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if which::which(\"apt-cache\").is_err() {\n    eprintln!(\"apt-cache unavailable; skipping apt availability checks\");\n}","typeGuard":null,"tryCatchPattern":"match provider.available(&names).await {\n    Err(e) if e.to_string() == \"apt-cache not found\" => {\n        // fall back to another provider or treat as unknown availability\n    }\n    r => r?,\n}","preventionTips":["Detect the distro and select dnf/pacman/apt providers accordingly.","Install apt-utils in minimal Debian containers.","Ensure CI PATH includes /usr/bin."],"tags":["apt","debian","missing-dependency","packages"],"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"}