{"record":{"id":"d6d95b8f339ee03d","repo":"jdx/mise","slug":"dotfile-target-must-be-absolute-or-start-with","errorCode":null,"errorMessage":"dotfile target must be absolute or start with ~/: {target}","messagePattern":"dotfile target must be absolute or start with ~/: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":581,"sourceCode":"                        \"source\"\n                            | \"content\"\n                            | \"mode\"\n                            | \"exclude\"\n                            | \"manifest\"\n                            | \"autosave\"\n                            | \"encrypt\"\n                            | \"variants\"\n                            | \"enabled\"\n                    ) {\n                        bail!(\n                            \"unknown dotfile key {key:?} for {target} in {}\",\n                            path.display()\n                        );\n                    }\n                }\n            }\n            if resolve_target_arg(&target).is_relative() {\n                bail!(\"dotfile target must be absolute or start with ~/: {target}\");\n            }\n            if let FileTomlEntry::Table {\n                source,\n                content,\n                mode,\n                manifest,\n                exclude,\n                ..\n            } = entry\n            {\n                if content.is_some() && (mode.is_some() || exclude.is_some() || manifest.is_some())\n                {\n                    bail!(\n                        \"dotfile {target}: inline content does not support mode, exclude, or manifest\"\n                    );\n                }\n                let mode = match mode.as_deref() {\n                    Some(value) => FileMode::parse(value).ok_or_else(|| {","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/files.rs#L563-L599","documentation":"Dotfile targets must resolve to an absolute path or begin with `~/` so mise can anchor them to your home directory. `resolve_target_arg` expands `~`; if the result is still relative, the declaration is rejected during preflight because relative targets are ambiguous (they would depend on the process working directory).","triggerScenarios":"Declaring a dotfile whose key is a relative path, e.g. `[dotfiles.\".bashrc\"]` or `[dotfiles.\"config/kitty/kitty.conf\"]`, with no leading `/` or `~/`.","commonSituations":"Copying examples from tools that use paths relative to a dotfiles repo, abbreviating `~/` away, or templating the target from a variable that lost its prefix.","solutions":["Prefix the target with `~/` (or use the absolute path) in the dotfiles table key.","If the file lives outside $HOME, use its absolute path, e.g. `/etc/profile.d/foo.sh`.","Re-check generated/templated config so the target key always includes the leading `~/` or `/`."],"exampleFix":"// before\n[dotfiles.\".config/kitty/kitty.conf\"]\nsource = \"kitty.conf\"\n\n// after\n[dotfiles.\"~/.config/kitty/kitty.conf\"]\nsource = \"kitty.conf\"","handlingStrategy":"validation","validationCode":"function assertAbsoluteOrHomeTarget(target) {\n  if (!(target.startsWith('~/') || target.startsWith('/')))\n    throw new Error(`dotfile target must be absolute or start with ~/: ${target}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  applyDotfiles();\n} catch (e) {\n  if (/must be absolute or start with ~\\//.test(e.message)) {\n    console.error('Prefix the offending dotfiles table key with ~/ or /');\n  } else throw e;\n}","preventionTips":["Always write dotfile targets with an explicit `~/` or absolute prefix","When generating config programmatically, assert the prefix before writing the file","Code-review dotfile additions for path style consistency"],"tags":["dotfiles","path-validation","config","mise"],"backgroundTag":"invalid-argument-format","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"}