jdx/mise · error

" ". : line may not contain a newline; use a block for…

Error message

"{path_raw}".{id}: line may not contain a newline; use a block for multi-line content, ignoring entry

What it means

Line-based edits match against a file's individual lines, so a `line` value containing an embedded newline can never converge — the matcher would never find a single file line equal to it. `resolve_entry` rejects such entries up front and ignores them, directing the user to use a `block` (marker-wrapped multi-line content) instead.

Solutions

  1. Move the multi-line content into a `block` (or `source`) entry.
  2. If a single line was intended, remove the embedded newline and trim whitespace.
  3. Re-run the edits command and confirm the entry is applied.

Example fix

# before
[dotfiles."~/.zshrc".setup]
line = """
export FOO=1
export BAR=2
"""

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

Strategy: validation

Validate before calling

if let Some(line) = &e.line {
    if line.contains('\n') {
        return Err("line must be a single line; use block for multi-line".into());
    }
}

Type guard

fn is_single_line(s: &str) -> bool { !s.contains('\n') }

Prevention

When it happens

Trigger: A line edit entry has `line = "first\nsecond"` (e.g. via a TOML multi-line string). `resolve_entry` checks `line.contains('\n')` and bails at src/system/edits.rs:352.

Common situations: Users write TOML multi-line strings ("""...""") for `line`, or paste a snippet with a trailing/leading newline into the `line` field.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/system/edits.rs:352

                        "\"{path_raw}\".{id}: unknown template engine '{other}' (expected \"tera\"), ignoring entry"
                    )
                }
            };
            let comment = entry
                .comment
                .unwrap_or_else(|| infer_comment(&path).to_string());
            EditOp::Block {
                source,
                template,
                comment,
            }
        }
        (false, Some(line)) => {
            // a "line" is matched against the file's individual lines, so an
            // embedded newline could never converge — use a block for
            // multi-line content
            if line.contains('\n') {
                bail!(
                    "\"{path_raw}\".{id}: line may not contain a newline; use a block for multi-line content, ignoring entry"
                )
            }
            let position = match entry.position.as_deref() {
                None | Some("append") => LinePosition::Append,
                Some("prepend") => LinePosition::Prepend,
                Some(other) => {
                    bail!(
                        "\"{path_raw}\".{id}: unknown line position '{other}' (expected \"append\" or \"prepend\"), ignoring entry"
                    )
                }
            };
            EditOp::Line {
                line: line.clone(),
                position,
            }
        }
    };

View on GitHub (pinned to 533346cc37)