{"record":{"id":"a720b68adf6382c3","repo":"jdx/mise","slug":"invalid-completion-specification-path","errorCode":null,"errorMessage":"invalid completion specification path","messagePattern":"invalid completion specification path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packslip/completions.rs","lineNumber":42,"sourceCode":"            .encode_wide()\n            .flat_map(u16::to_le_bytes)\n            .collect()\n    };\n    base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(bytes)\n}\n\npub(crate) fn decode_spec_path(encoded: &str) -> eyre::Result<std::path::PathBuf> {\n    use base64::Engine;\n    let bytes = base64::engine::general_purpose::URL_SAFE_NO_PAD.decode(encoded)?;\n    #[cfg(unix)]\n    let path = {\n        use std::os::unix::ffi::OsStringExt;\n        std::ffi::OsString::from_vec(bytes)\n    };\n    #[cfg(windows)]\n    let path = {\n        use std::os::windows::ffi::OsStringExt;\n        if !bytes.len().is_multiple_of(2) {\n            eyre::bail!(\"invalid completion specification path\");\n        }\n        let wide: Vec<_> = bytes\n            .chunks_exact(2)\n            .map(|b| u16::from_le_bytes([b[0], b[1]]))\n            .collect();\n        std::ffi::OsString::from_wide(&wide)\n    };\n    Ok(path.into())\n}\n\npub(crate) fn clear(shell: &str) -> &'static str {\n    match shell {\n        \"bash\" | \"zsh\" => {\n            \"if typeset -f __mise_clear_completions >/dev/null; then __mise_clear_completions; unset -f __mise_clear_completions; fi\\n\"\n        }\n        \"fish\" => {\n            \"if functions -q __mise_clear_completions; __mise_clear_completions; functions -e __mise_clear_completions; end\\n\"","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/packslip/completions.rs#L24-L60","documentation":"A completion specification path is serialized as bytes and decoded into an OsString. On Windows it must be UTF-16 little-endian, so the byte length must be even; an odd-length buffer cannot be a valid wide string, so `decode_spec_path` bails. This indicates corruption or a producer/consumer mismatch in the completion spec blob.","triggerScenarios":"Decoding a completion specification whose path field has an odd number of bytes on Windows — truncated file, hand-edited spec, or a spec written by a non-Windows producer without UTF-16 encoding.","commonSituations":"Shared caches or manifests copied from WSL/Linux into Windows mise; partial download of the completion spec; cross-version mise where the spec serialization changed.","solutions":["Regenerate or re-download the completion specification so the path field is intact UTF-16","Clear mise's packslip/completion cache and retry the install","Verify you're not hand-editing or post-processing the spec file between write and read","Ensure both producing and consuming mise versions are current and matched"],"exampleFix":"// before: odd-length byte buffer from a truncated spec\nbytes = [0x67, 0x00, 0x68]  // 3 bytes\n// after: re-fetch the spec so path is valid UTF-16LE\nbytes = [0x67, 0x00, 0x68, 0x00]  // 4 bytes, even length","handlingStrategy":"validation","validationCode":"if spec_path_bytes.len() % 2 != 0 { return Err('corrupt UTF-16LE path in completion spec'); }","typeGuard":"fn is_valid_wide_path(bytes: &[u8]) -> bool { bytes.len() % 2 == 0 }","tryCatchPattern":"match decode_spec_path(bytes) {\n    Ok(path) => use(path),\n    Err(e) => { invalidate_spec_cache(); refetch_spec()?; }\n}","preventionTips":["Never hand-edit or truncate completion spec files","Don't move spec caches between WSL/Linux and Windows without regeneration","Re-download the spec after any mise version change"],"tags":["windows","encoding","packslip","completions"],"backgroundTag":"invalid-argument-format","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"}