{"record":{"id":"d4022a0a357f8d04","repo":"jdx/mise","slug":"path-raw-id-line-may-not-contain-a-newline","errorCode":null,"errorMessage":"\"{path_raw}\".{id}: line may not contain a newline; use a block for multi-line content, ignoring entry","messagePattern":"\"(.+?)\"\\.(.+?): line may not contain a newline; use a block for multi-line content, ignoring entry","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/edits.rs","lineNumber":352,"sourceCode":"                        \"\\\"{path_raw}\\\".{id}: unknown template engine '{other}' (expected \\\"tera\\\"), ignoring entry\"\n                    )\n                }\n            };\n            let comment = entry\n                .comment\n                .unwrap_or_else(|| infer_comment(&path).to_string());\n            EditOp::Block {\n                source,\n                template,\n                comment,\n            }\n        }\n        (false, Some(line)) => {\n            // a \"line\" is matched against the file's individual lines, so an\n            // embedded newline could never converge — use a block for\n            // multi-line content\n            if line.contains('\\n') {\n                bail!(\n                    \"\\\"{path_raw}\\\".{id}: line may not contain a newline; use a block for multi-line content, ignoring entry\"\n                )\n            }\n            let position = match entry.position.as_deref() {\n                None | Some(\"append\") => LinePosition::Append,\n                Some(\"prepend\") => LinePosition::Prepend,\n                Some(other) => {\n                    bail!(\n                        \"\\\"{path_raw}\\\".{id}: unknown line position '{other}' (expected \\\"append\\\" or \\\"prepend\\\"), ignoring entry\"\n                    )\n                }\n            };\n            EditOp::Line {\n                line: line.clone(),\n                position,\n            }\n        }\n    };","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/edits.rs#L334-L370","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users write TOML multi-line strings (\"\"\"...\"\"\") for `line`, or paste a snippet with a trailing/leading newline into the `line` field.","solutions":["Move the multi-line content into a `block` (or `source`) entry.","If a single line was intended, remove the embedded newline and trim whitespace.","Re-run the edits command and confirm the entry is applied."],"exampleFix":"# before\n[dotfiles.\"~/.zshrc\".setup]\nline = \"\"\"\nexport FOO=1\nexport BAR=2\n\"\"\"\n\n# after\n[dotfiles.\"~/.zshrc\".setup]\nblock = \"export FOO=1\\nexport BAR=2\"","handlingStrategy":"validation","validationCode":"if let Some(line) = &e.line {\n    if line.contains('\\n') {\n        return Err(\"line must be a single line; use block for multi-line\".into());\n    }\n}","typeGuard":"fn is_single_line(s: &str) -> bool { !s.contains('\\n') }","tryCatchPattern":null,"preventionTips":["Use `line` only for single-line strings; use `block` for anything multi-line.","Avoid TOML multi-line string literals (\"\"\"...\"\"\") for `line` values.","Trim pasted snippets of leading/trailing newlines before putting them in `line`."],"tags":["config","validation","dotfiles"],"backgroundTag":"invalid-config-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}