{"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":557,"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":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/files.rs#L539-L575","documentation":"During dotfiles preflight validation, each `[dotfiles.<target>]` entry in a config file must be parseable into a known declaration shape (whole-file entry or a managed line/block/template edit). If the TOML value cannot be parsed and it also does not look like a line/block/template/comment/position edit entry, mise rejects the whole config so nothing is silently dropped. This is a fail-fast guard so a typo never results in a partially applied dotfiles setup.","triggerScenarios":"A `[dotfiles.\"~/.vimrc\"]` entry whose value is not a table and not a string (e.g. a bare number or boolean), or a table that `file_entry_from_toml` cannot interpret (e.g. only unrecognized keys, wrong value types for `source`/`content`), while lacking any of the edit-engine keys `block`, `line`, `template`, `comment`, or `position`.","commonSituations":"Typos in the entry structure, writing the dotfile value as a scalar instead of a table/string, hand-merging config fragments that dropped required fields, or copying an edit-entry format from docs that uses different key names.","solutions":["Check the entry in the config file named in the message; make it a valid dotfile table (e.g. source = \"...\" or content = \"...\").","If you meant a managed edit, include the `line` or `block` key (with `template`, `comment`, or `position` as needed) so the edit engine handles it.","Run `mise doctor` or the dotfiles status command to see which config file failed and fix its TOML syntax.","Verify the value parses as TOML (no stray quotes, correct = syntax) with a TOML linter."],"exampleFix":"// before (mise config.toml)\n[dotfiles.\"~/.vimrc\"]\nsoruce = \"vimrc\"        # typo'd key, nothing parseable\n\n// after\n[dotfiles.\"~/.vimrc\"]\nsource = \"vimrc\"","handlingStrategy":"validation","validationCode":"// run before apply: `mise doctor` or a TOML sanity pass\nimport toml from 'js-toml';\nfunction assertDotfileEntry(cfg) {\n  const v = cfg.dotfiles?.[target];\n  if (typeof v !== 'string' && (typeof v !== 'object' || v === null))\n    throw new Error(`${target}: not a valid dotfile declaration`);\n  const editKeys = ['block','line','template','comment','position'];\n  const known = ['source','content','mode','exclude','manifest','autosave','encrypt','variants','enabled'];\n  if (typeof v === 'object' && !editKeys.some(k => k in v) && !known.some(k => k in v))\n    throw new Error(`${target}: unparseable dotfile declaration`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  applyDotfiles();\n} catch (e) {\n  if (/invalid dotfile declaration/.test(e.message)) {\n    console.error('Fix the dotfiles entry named in the message before re-running');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Validate config TOML with a schema/linter in CI before committing dotfile entries","Copy entries from documented examples only; keep one canonical dotfiles config","Run the dotfiles status command after every config edit"],"tags":["dotfiles","config-validation","toml","mise"],"backgroundTag":"schema-validation-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}