{"record":{"id":"1a32e4b3bb94cbb1","repo":"jdx/mise","slug":"invalid-dotfile-declaration-target-in","errorCode":null,"errorMessage":"invalid dotfile declaration {target} in {}","messagePattern":"invalid dotfile declaration (.+?) in (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":661,"sourceCode":"                    && [\"content\", \"block\", \"line\", \"template\"]\n                        .iter()\n                        .any(|key| t.contains_key(*key))\n            }) {\n                bail!(\n                    \"encrypted dotfile {target} requires an external source, not inline content or edits\"\n                );\n            }\n            let Some(entry) = file_entry_from_toml(&target, value.clone()) else {\n                // Managed line/block edits are handled by the edit engine,\n                // not by this whole-file declaration parser.\n                if value.as_table().is_some_and(|table| {\n                    [\"block\", \"line\", \"template\", \"comment\", \"position\"]\n                        .iter()\n                        .any(|key| table.contains_key(*key))\n                }) {\n                    continue;\n                }\n                bail!(\"invalid dotfile declaration {target} in {}\", path.display());\n            };\n            if let Some(table) = value.as_table() {\n                for key in table.keys() {\n                    if !matches!(\n                        key.as_str(),\n                        \"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()","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L643-L679","documentation":"`validate_incoming_files` parses each `[dotfiles]` entry via `file_entry_from_toml`. Entries that are neither a plain source string nor a recognizable whole-file declaration (and are not managed line/block edit entries, which are skipped) fail to parse and produce this error naming the config file path.","triggerScenarios":"An entry value that does not fit `FileTomlEntry` — e.g. a table missing any recognized whole-file keys like `source`/`content`, or a wrong-typed value — and which does not look like a block/line/template/comment edit entry.","commonSituations":"Typos in the `source` key leaving an entry table with only unknown keys; nesting entries accidentally; pasting an edit-style entry (`line`/`block`) with malformed fields into a whole-file context in the wrong config file.","solutions":["Ensure each entry is either a string source or a table with at least `source` or `content`","Fix key typos so a recognized whole-file key is present","Move managed line/block edits to the edit-engine section instead of the whole-file `[dotfiles]` parser"],"exampleFix":"// before\n\"~/.gitconfig\" = { surce = \"dotfiles/gitconfig\" }  # typo: key unrecognized\n// after\n\"~/.gitconfig\" = { source = \"dotfiles/gitconfig\" }","handlingStrategy":"validation","validationCode":"function looksLikeWholeFileEntry(v) {\n  return typeof v === 'string' || (v && typeof v === 'object' && ('source' in v || 'content' in v));\n}","typeGuard":"const isValidEntry = (v: unknown): v is string | { source?: string; content?: string } =>\n  typeof v === 'string' || (typeof v === 'object' && v !== null && ('source' in v || 'content' in v));","tryCatchPattern":"try { validateIncomingFiles(cfg); } catch (e) {\n  if (/invalid dotfile declaration/.test(String(e.message))) {\n    // extract target and file path from message, fix the entry shape\n  } else throw e;\n}","preventionTips":["Model entries as `\"target\" = \"source\"` or `\"target\" = { source = \"...\" }`","Fix key typos (`source` not `surce`)","Keep managed line/block edits out of the whole-file declaration parser"],"tags":["config","dotfiles","schema-validation"],"backgroundTag":"schema-validation-failed","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"}