jdx/mise · error
invalid dotfile declaration
Error message
invalid dotfile declaration {target} in {} What it means
`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.
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
Example fix
// before
"~/.gitconfig" = { surce = "dotfiles/gitconfig" } # typo: key unrecognized
// after
"~/.gitconfig" = { source = "dotfiles/gitconfig" } Defensive patterns
Strategy: validation
Validate before calling
function looksLikeWholeFileEntry(v) {
return typeof v === 'string' || (v && typeof v === 'object' && ('source' in v || 'content' in v));
} Type guard
const isValidEntry = (v: unknown): v is string | { source?: string; content?: string } =>
typeof v === 'string' || (typeof v === 'object' && v !== null && ('source' in v || 'content' in v)); Try / catch
try { validateIncomingFiles(cfg); } catch (e) {
if (/invalid dotfile declaration/.test(String(e.message))) {
// extract target and file path from message, fix the entry shape
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- an implied source entry key must be relative
- an implied source entry key must not be empty
- an implied source entry key must not contain '..'
- brew-cask: unsupported
- conflicting dotfile declarations for
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/1a32e4b3bb94cbb1.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/files.rs:661
&& ["content", "block", "line", "template"]
.iter()
.any(|key| t.contains_key(*key))
}) {
bail!(
"encrypted dotfile {target} requires an external source, not inline content or edits"
);
}
let Some(entry) = file_entry_from_toml(&target, value.clone()) else {
// Managed line/block edits are handled by the edit engine,
// not by this whole-file declaration parser.
if value.as_table().is_some_and(|table| {
["block", "line", "template", "comment", "position"]
.iter()
.any(|key| table.contains_key(*key))
}) {
continue;
}
bail!("invalid dotfile declaration {target} in {}", path.display());
};
if let Some(table) = value.as_table() {
for key in table.keys() {
if !matches!(
key.as_str(),
"source"
| "content"
| "mode"
| "exclude"
| "manifest"
| "autosave"
| "encrypt"
| "variants"
| "enabled"
) {
bail!(
"unknown dotfile key {key:?} for {target} in {}",
path.display()View on GitHub (pinned to 533346cc37)