{"record":{"id":"0ae487a07ea02087","repo":"jdx/mise","slug":"bootstrap-macos-dock-apps-expected-a-path-relative-to-home","errorCode":null,"errorMessage":"[bootstrap.macos.dock].apps: expected a path relative to home: {value}","messagePattern":"\\[bootstrap\\.macos\\.dock\\]\\.apps: expected a path relative to home: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/defaults/dock.rs","lineNumber":18,"sourceCode":"//! Application layout semantics for the friendly Dock setting. Raw defaults remain exact.\nuse std::path::{Component, Path, PathBuf};\n\nuse super::DefaultsValue;\nuse crate::result::Result;\n\npub(super) fn paths(value: &DefaultsValue) -> Result<Vec<PathBuf>> {\n    let DefaultsValue::Array(values) = value else {\n        eyre::bail!(\"[bootstrap.macos.dock].apps: expected an array of application paths\");\n    };\n    let mut paths = Vec::new();\n    let mut seen = std::collections::HashSet::new();\n    for value in values {\n        let DefaultsValue::Str(value) = value else {\n            eyre::bail!(\"[bootstrap.macos.dock].apps: expected an array of application paths\");\n        };\n        let path = if let Some(rest) = value.strip_prefix(\"~/\") {\n            eyre::ensure!(\n                !Path::new(rest).has_root(),\n                \"[bootstrap.macos.dock].apps: expected a path relative to home: {value}\"\n            );\n            crate::env::HOME.join(rest)\n        } else {\n            PathBuf::from(value)\n        };\n        eyre::ensure!(\n            path.is_absolute()\n                && path\n                    .extension()\n                    .is_some_and(|ext| ext.eq_ignore_ascii_case(\"app\"))\n                && !path.components().any(|c| matches!(c, Component::ParentDir))\n                && !value.contains('\\0'),\n            \"[bootstrap.macos.dock].apps: expected an absolute or ~/ application path: {value}\"\n        );\n        let path: PathBuf = path.components().collect();\n        eyre::ensure!(","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/defaults/dock.rs#L1-L36","documentation":"Thrown by dock::paths while validating [bootstrap.macos.dock].apps entries. Values written as \"~/...\" must be relative to the home directory; if the portion after \"~/\" still has a root component (e.g. \"~//abs\" or \"~/C:/x\" style input), joining it to HOME would silently discard HOME, so the value is rejected.","triggerScenarios":"A dock.apps entry of the form \"~/<rooted-path>\", e.g. \"~/ /Applications/Foo.app\" or \"~/\\\\\\\\host\\\\share\\\\Foo.app\", where strip_prefix(\"~/\") leaves an absolute path.","commonSituations":"Double slashes or stray spaces after the tilde; Windows-style absolute paths pasted after ~; mis-templated paths where a variable expanded to an absolute path following \"~/\".","solutions":["Write the value as a plain absolute path (e.g. \"/Applications/Foo.app\") instead of \"~/...\"","Fix the path so everything after \"~/\" is genuinely relative (no leading slash or drive letter)","Check templates/variables that interpolate into the apps array for accidental absolute expansions"],"exampleFix":"// before\napps = [\"~//Applications/Safari.app\"]\n// after\napps = [\"~/Applications/Safari.app\"]  // or \"/Applications/Safari.app\"","handlingStrategy":"validation","validationCode":"fn validate_dock_app(value: &str) -> Result<(), String> {\n    if let Some(rest) = value.strip_prefix(\"~/\") {\n        if Path::new(rest).has_root() {\n            return Err(format!(\"{value} is not relative to home\"));\n        }\n    }\n    Ok(())\n}","typeGuard":"fn is_home_relative_tilde(value: &str) -> bool {\n    value.strip_prefix(\"~/\").map_or(false, |r| !Path::new(r).has_root())\n}","tryCatchPattern":null,"preventionTips":["Use either plain absolute paths or clean \"~/relative\" forms, never mixed","Watch for double slashes and expanded variables after \"~/\"","Lint dock.apps entries for path shape before applying"],"tags":["macos","dock","paths","validation"],"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"}