{"record":{"id":"30dd16043997eae2","repo":"jdx/mise","slug":"err-failed-to-join-path-segments-wrapped-as-std-io-error","errorCode":null,"errorMessage":"{err} (failed to join PATH segments; wrapped as std::io::Error with kind InvalidInput)","messagePattern":"(.+?) \\(failed to join PATH segments; wrapped as std::io::Error with kind InvalidInput\\)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"src/cli/activate.rs","lineNumber":306,"sourceCode":"    }\n    flags\n}\n\nfn position_shims_before_path() -> std::io::Result<Option<ActivatePrelude>> {\n    let user_shims = dirs::shims();\n    let system_shims = dirs::system_shims();\n    let mut path = vec![user_shims];\n    if system_shims.is_dir() && !file::storage_paths_eq(&path[0], &system_shims) {\n        path.push(system_shims);\n    }\n    path.extend(\n        env::PATH\n            .iter()\n            .filter(|path| !file::is_mise_shims_dir(path))\n            .cloned(),\n    );\n    let path = std::env::join_paths(path)\n        .map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidInput, err))?;\n    Ok(Some(ActivatePrelude::Set(\n        PATH_KEY.to_string(),\n        path.to_string_lossy().to_string(),\n    )))\n}\n\nfn remove_shims_from_path() -> std::io::Result<Option<ActivatePrelude>> {\n    if !env::PATH.iter().any(|path| file::is_mise_shims_dir(path)) {\n        return Ok(None);\n    }\n    let path = std::env::join_paths(\n        env::PATH\n            .iter()\n            .filter(|path| !file::is_mise_shims_dir(path)),\n    )\n    .map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidInput, err))?;\n    Ok(Some(ActivatePrelude::Set(\n        PATH_KEY.to_string(),","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/activate.rs#L288-L324","documentation":"In `position_shims_before_path`, mise rebuilds the PATH (with shims directories removed/repositioned) using `std::env::join_paths`. If any segment contains the platform path separator character (e.g. a directory whose name contains `:` on Unix), `join_paths` fails with `JoinPathsError`, which mise wraps as an `std::io::Error` of kind `InvalidInput` and surfaces with this message.","triggerScenarios":"Calling `activate` when the inherited `PATH` contains an entry with an embedded path-separator character, causing `std::env::join_paths` in `position_shims_before_path` to return `Err`.","commonSituations":"A directory literally named with a colon (`my:dir`) added to PATH; a broken shell profile exporting PATH entries containing `:`; artifacts of sloppy env manipulation by another tool.","solutions":["Find the offending PATH entry (`echo $PATH | tr ':' '\\n'`) and rename the directory or remove it from PATH.","Fix the shell profile/export that introduced the separator-containing entry.","Temporarily unset/repair PATH and re-run `mise activate`."],"exampleFix":"// before\nexport PATH=\"$PATH:/opt/my:weird/dir\"\n\n// after\nexport PATH=\"$PATH:/opt/my-weird-dir\"","handlingStrategy":"validation","validationCode":"echo \"$PATH\" | tr ':' '\\n' | grep -n ':' || echo \"PATH entries clean\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never name directories with the PATH separator character.","Audit shell profiles for malformed PATH exports.","Sanitize PATH before running `mise activate` in scripts."],"tags":["path","shell","activate","invalid-input"],"backgroundTag":"invalid-argument-value","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"}