jdx/mise · error

" ". : block/source and line are mutually exclusive…

Error message

"{path_raw}".{id}: block/source and line are mutually exclusive, ignoring entry

What it means

In mise's dotfile-edit system, each `[dotfiles]` edit entry must specify exactly one operation: either block/source content or a single `line`. When `resolve_entry` (called while parsing config files in `edits_from_config_files`) sees an entry with `block` or `source` set AND a `line`, the entry is ambiguous, so mise bails and ignores that entry. This is a defensive parse-time validation to make edit semantics deterministic.

Solutions

  1. Remove the `line` field if you want a block/source (marker-wrapped) edit.
  2. Remove the `block`/`source` fields if you want a single-line append/prepend edit.
  3. Split into two separate edit entries if both operations are genuinely needed.
  4. Re-run `mise edits` and confirm the entry is no longer reported as ignored.

Example fix

# before
[dotfiles."~/.zshrc".my-edit]
line = "export FOO=1"
block = "export FOO=1\nexport BAR=2"

# after
[dotfiles."~/.zshrc".my-edit]
block = "export FOO=1\nexport BAR=2"
Defensive patterns

Strategy: validation

Validate before calling

for (id, e) in &entries {
    if (e.block.is_some() || e.source.is_some()) && e.line.is_some() {
        return Err(format!("entry {id}: set either line OR block/source, not both"));
    }
}

Type guard

fn is_block_entry(e: &EditEntry) -> bool { e.block.is_some() || e.source.is_some() }

Prevention

When it happens

Trigger: A TOML edit entry defines both `line = "..."` and `block = "..."` (or `source = "file"`). `resolve_entry` matches `(is_block=true, Some(line))` and bails at src/system/edits.rs:297 during `edits_from_config_files`.

Common situations: Users copy a block-style entry and add a `line` field to tweak matching, or merge two config files (one using line edits, one using block edits) so a single entry ends up with both fields set.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/a333a028ffcc2a2e. Report an issue: GitHub.

Appendix: source

Thrown at src/system/edits.rs:297

        config_root: crate::config::config_file::config_root::config_root(config_path),
        environment: crate::config::environments_for_config_path(config_path),
        source: None,
    };
    let entry = match entry {
        EditTomlEntry::Block(inline) => EditTomlTable {
            block: Some(inline),
            source: None,
            template: None,
            line: None,
            position: None,
            comment: None,
        },
        EditTomlEntry::Table(table) => table,
    };
    let is_block = entry.block.is_some() || entry.source.is_some();
    let op = match (&is_block, &entry.line) {
        (true, Some(_)) => {
            bail!(
                "\"{path_raw}\".{id}: block/source and line are mutually exclusive, ignoring entry"
            )
        }
        (false, None) => {
            bail!(
                "\"{path_raw}\".{id}: no recognized operation (block, source, or line), ignoring entry"
            )
        }
        (true, None) => {
            if entry.position.is_some() {
                bail!("\"{path_raw}\".{id}: position is only valid with line, ignoring entry")
            }
            let source = match (entry.block, entry.source) {
                (Some(_), Some(_)) => {
                    bail!(
                        "\"{path_raw}\".{id}: block and source are mutually exclusive, ignoring entry"
                    )
                }

View on GitHub (pinned to 533346cc37)