{"record":{"id":"e69fcb05ceabe140","repo":"jdx/mise","slug":"target-raw-target-must-be-absolute-or-start-wit","errorCode":null,"errorMessage":"{target_raw}: target must be absolute or start with ~/","messagePattern":"(.+?): target must be absolute or start with ~/","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/add.rs","lineNumber":164,"sourceCode":"            }\n        }\n        let config_path = resolve_target_config_path(ConfigPathOptions {\n            global: self.global || !self.local,\n            path: self.path.clone(),\n            env: None,\n            cwd: None,\n            prefer_toml: true,\n            prevent_home_local: true,\n        })?;\n\n        let mut planned = vec![];\n        let managed_edits = system::edits::edits_from_config(&config)?;\n        for target_raw in &self.targets {\n            let target = system::files::resolve_target_arg(target_raw)\n                .components()\n                .collect::<PathBuf>();\n            if target.is_relative() {\n                bail!(\"{target_raw}: target must be absolute or start with ~/\");\n            }\n            if managed\n                .iter()\n                .any(|req| req.mode == FileMode::Track && req.target == target)\n            {\n                bail!(\n                    \"{target_raw}: tracked in place; pass `--mode copy` after `mise dot untrack {target_raw}` to seed a source instead\"\n                );\n            }\n            if managed_edits.iter().any(|req| {\n                system::files::matches_target(\n                    &req.path,\n                    &req.path_raw,\n                    std::slice::from_ref(target_raw),\n                )\n            }) {\n                bail!(\n                    \"{target_raw}: target is already managed by [dotfiles] edits; remove or rename those entries before adding a whole-file dotfile\"","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/add.rs#L146-L182","documentation":"Dotfile targets managed by mise must live at a fixed absolute location (or under the user's home via `~/`). run_inner resolves each target argument and, if the resulting path is still relative, bails naming the raw target, because relative targets would be ambiguous across working directories.","triggerScenarios":"Running `mise dotfiles add <relative-path>` (e.g. `dotfiles add .zshrc` or `dotfiles add ./config.toml`) where resolve_target_arg yields a relative PathBuf and target.is_relative() is true.","commonSituations":"Running the command from the directory containing the dotfile and passing a bare filename; scripts using relative paths derived from $PWD; typos like a missing leading `~` or `/`.","solutions":["Prefix the target with `~/` (e.g. `mise dotfiles add ~/.zshrc`).","Or pass a fully absolute path (`/home/user/.zshrc`).","In scripts, expand the path before invoking: `mise dotfiles add \"$HOME/.zshrc\"`."],"exampleFix":"// before\n$ mise dotfiles add .zshrc\nError: .zshrc: target must be absolute or start with ~/ (mise dotfiles add)\n\n// after\n$ mise dotfiles add ~/.zshrc","handlingStrategy":"validation","validationCode":"# expand to an absolute path before calling add\nfor t in \"$@\"; do\n  case \"$t\" in\n    /*|~/*) ;; # ok\n    *) echo \"target '$t' must be absolute or start with ~/\" >&2; exit 2 ;;\n  esac\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use `~/`-prefixed or absolute paths for dotfile targets.","In scripts, expand relative paths via \"$HOME/...\" before invoking.","Never rely on the current working directory to resolve dotfile targets."],"tags":["dotfiles","cli","path","validation"],"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"}