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

  1. Ensure each entry is either a string source or a table with at least `source` or `content`
  2. Fix key typos so a recognized whole-file key is present
  3. 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

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


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)