{"record":{"id":"7a9505428c7dea0b","repo":"jdx/mise","slug":"dotfiles-block-content-may-not-contain","errorCode":null,"errorMessage":"[dotfiles].\"{}/{}\": block content may not contain its own marker lines","messagePattern":"\\[dotfiles\\]\\.\"(.+?)/(.+?)\": block content may not contain its own marker lines","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/edits.rs","lineNumber":490,"sourceCode":"            &raw,\n            config.bootstrap_tera_ctx(&req.origin.config),\n        )\n        .map_err(|err| {\n            eyre::eyre!(\n                \"[dotfiles].\\\"{}/{}\\\": failed to render template: {err}\",\n                req.path_raw,\n                req.id\n            )\n        })?\n    } else {\n        raw\n    };\n    let content = content.trim_end_matches('\\n').to_string();\n    // a block containing its own marker lines would write a file that can't\n    // be parsed back — refuse up front instead of corrupting on reapply\n    for pat in [format!(\">>> mise:{id} >>>\"), format!(\"<<< mise:{id} <<<\")] {\n        if content.lines().any(|l| is_marker_line(l, &pat, comment)) {\n            bail!(\n                \"[dotfiles].\\\"{}/{}\\\": block content may not contain its own marker lines\",\n                req.path_raw,\n                req.id\n            );\n        }\n    }\n    Ok(Some(content))\n}\n\n/// Current state of one edit on this machine.\n///\n/// Note: comparing a template block against existing markers requires\n/// rendering it, so this can run the template engine — including `exec()` —\n/// from `mise bootstrap dotfiles status`. That's the same trust model as `[env]`\n/// templates. Rendering only happens once every render-free outcome (symlink\n/// target, missing file, absent or corrupted markers) has been ruled out,\n/// and `--dry-run` skips template rendering entirely (see [`apply`]).\npub(crate) fn check(config: &Config, req: &EditRequest) -> Result<FileState> {","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/edits.rs#L472-L508","documentation":"Block edits delimit their managed content with marker lines (\">>> mise:<id> >>>\" and \"<<< mise:<id> <<<\", optionally commented). If the block content itself contains a line matching its own markers, the written file could not be parsed back on reapply. desired_content refuses up front during check/apply/diff instead of corrupting the file.","triggerScenarios":"The rendered block content of a [dotfiles] entry includes a line that matches the marker pattern for that entry's id — e.g. the content literally contains \">>> mise:myid >>>\" or \"<<< mise:myid <<<\", possibly produced via templating.","commonSituations":"Managing a config file that itself contains mise edit markers for the same id (nesting attempt); templated content that emits marker-like lines; id collisions after renaming.","solutions":["Remove the marker lines from the block content.","Change the entry's id so the marker pattern no longer matches the content.","If the target file legitimately contains similar text, manage it with a `line` entry or a different comment/id combination."],"exampleFix":"// before (content contains its own marker)\n[[dotfiles]]\nid = \"snippet\"\npath = \"~/.zshrc\"\nblock = \"\"\">>> mise:snippet >>>\nalias gs='git status'\"\"\"\n\n// after\n[[dotfiles]]\nid = \"snippet\"\npath = \"~/.zshrc\"\nblock = \"alias gs='git status'\"","handlingStrategy":"validation","validationCode":"for l in block_content.lines() {\n    assert!(!l.contains(&format!(\">>> mise:{id} >>>\")) && !l.contains(&format!(\"<<< mise:{id} <<<\")),\n        \"entry {id}: block content may not contain its own marker lines\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never include mise marker lines inside managed block content.","When renaming an entry id, scrub old markers from the target file.","If templated content could emit marker-like lines, escape or restructure it."],"tags":["config","validation","dotfiles","markers"],"backgroundTag":"invalid-config-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}