{"record":{"id":"e6bce6e30b1b4855","repo":"jdx/mise","slug":"pre-use-hook-is-not-implemented","errorCode":null,"errorMessage":"pre_use hook is not implemented","messagePattern":"pre_use hook is not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/vfox/src/hooks/pre_use.rs","lineNumber":26,"sourceCode":"#[allow(dead_code)]\n#[derive(Debug)]\npub(crate) struct PreUseContext {\n    pub installed_sdks: IndexMap<String, SdkInfo>,\n}\n\n#[derive(Debug)]\npub struct PreUseResponse {\n    pub version: Option<String>,\n}\n\nimpl Plugin {\n    pub async fn pre_use(&self, _vfox: &Vfox, _legacy_file: &Path) -> Result<PreUseResponse> {\n        debug!(\"[vfox:{}] pre_use\", self.name);\n        // let ctx = PreUseContext {\n        //     installed_sdks: vfox.list_installed_versions(&self.name)?,\n        // };\n\n        unimplemented!(\"pre_use hook is not implemented\");\n    }\n}\n","sourceCodeStart":8,"sourceCodeEnd":29,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/crates/vfox/src/hooks/pre_use.rs#L8-L29","documentation":"The vfox plugin compatibility layer declares a pre_use hook API, but no plugin can actually provide a pre_use implementation: the method is hard-wired to unimplemented!, so calling it always panics. It exists only as a placeholder in the trait surface.","triggerScenarios":"Any code path that invokes VfoxPlugin::pre_use — e.g. tool request resolution asking a vfox plugin for legacy-file-driven version switching before use.","commonSituations":"Users coming from asdf/vfox expecting pre-use version rewriting hooks to work under mise's vfox backend; contributors wiring up hook dispatch hit the panic during testing.","solutions":["Avoid relying on pre_use behavior with vfox plugins under mise; configure versions explicitly in mise.toml/.tool-versions instead","Check whether the vfox plugin actually needs a pre-use hook; if so, use an asdf plugin or a mise-native backend that supports the behavior","Implement the hook (build PreUseContext from vfox.list_installed_versions and dispatch to the plugin's Lua pre_use script) and submit a PR"],"exampleFix":"// before (crates/vfox/src/hooks/pre_use.rs)\nunimplemented!(\"pre_use hook is not implemented\");\n// after\nlet ctx = PreUseContext {\n    installed_sdks: vfox.list_installed_versions(&self.name)?,\n    legacy_file: _legacy_file.to_path_buf(),\n};\nself.run_hook(\"pre_use\", ctx).await","handlingStrategy":"fallback","validationCode":"// A vfox plugin's pre_use hook will always panic; don't depend on it.\n// Instead ensure versions are pinned:\n// mise ls swift   # confirm explicit installed version exists","typeGuard":null,"tryCatchPattern":"match std::panic::catch_unwind(|| plugin.pre_use(...)) { ... } // only when shelling into plugin dispatch you don't control","preventionTips":["Never rely on pre-use hooks when using vfox plugins under mise","Pin exact versions in mise.toml instead of relying on legacy-file/pre-use resolution","Prefer mise-native or asdf backends when a workflow requires pre-use hook behavior","Check plugin compatibility docs before migrating asdf workflows to vfox"],"tags":["vfox","plugin","unimplemented","hook"],"backgroundTag":"method-not-implemented","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}