{"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 dot 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/533346cc374382b41ec5ff70536252b2e96e725c/src/system/edits.rs#L472-L508","documentation":"Block edits wrap their content in `>>> mise:<id> >>>` / `<<< mise:<id> <<<` marker lines so mise can find and replace the region on reapply. If the block's own content contains a line matching one of its markers, the written file could not be parsed back into a single managed region, so `desired_content` refuses up front instead of corrupting the target on a later apply. This check runs in `desired_content`, which is called by check, apply, print_diffs, and apply_dry_run_to_string.","triggerScenarios":"A block entry's `block` (or sourced file) content includes a line like `>>> mise:myid >>>` or `<<< mise:myid <<<` matching its own id/comment style. `desired_content` iterates both marker patterns and bails at src/system/edits.rs:490.","commonSituations":"Users copy an existing mise-managed region into another entry's content, nest dotfile configs that re-include their own markers, or generate templated content that embeds markers.","solutions":["Remove the marker-like lines from the block content.","Change the entry's `id` so its markers no longer match the content.","Set a different `comment` style if the collision comes from comment formatting.","Move the pre-managed region out of the block and let mise manage it with its own separate entry."],"exampleFix":"# before\n[dotfiles.\"~/.zshrc\".nested]\nid = \"nested\"\nblock = \" >>> mise:nested >>>\\necho hi\"\n\n# after\n[dotfiles.\"~/.zshrc\".nested]\nid = \"nested\"\nblock = \"echo hi\"","handlingStrategy":"validation","validationCode":"let content = e.block.as_deref().unwrap_or(\"\");\nfor pat in [format!(\">>> mise:{} >>>\", id), format!(\"<<< mise:{} <<<\", id)] {\n    if content.lines().any(|l| l.contains(&pat)) {\n        return Err(format!(\"block content contains its own marker {pat}\"));\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never paste an existing mise-managed region (including markers) into another block entry.","Give each entry a unique id so markers can't collide.","Search block content for `mise:` before committing if you manage files that already contain managed regions."],"tags":["config","validation","dotfiles","idempotency"],"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"}