{"record":{"id":"1eece8be77c26c2d","repo":"jdx/mise","slug":"edits-cannot-apply-these-entries-fix-them-manual","errorCode":null,"errorMessage":"edits: cannot apply these entries, fix them manually:\n{}","messagePattern":"edits: cannot apply these entries, fix them manually:\n(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/edits.rs","lineNumber":689,"sourceCode":"            // markers exist: compare content to see if anything would change\n            None => match block_state(req, desired.as_deref()) {\n                Ok(FileState::Applied) => continue,\n                Ok(_) => todo.push((req, desired)),\n                Err(err) => {\n                    problems.push(format!(\n                        \"  \\\"{}\\\" ({}): {err}\",\n                        req.path_raw,\n                        req.describe_op()\n                    ));\n                    continue;\n                }\n            },\n            // missing — needs applying\n            Some(_) => todo.push((req, desired)),\n        }\n    }\n    if !problems.is_empty() {\n        bail!(\n            \"edits: cannot apply these entries, fix them manually:\\n{}\",\n            problems.join(\"\\n\")\n        );\n    }\n    if todo.is_empty() {\n        info!(\"edits: all edits are applied\");\n        return Ok(true);\n    }\n    if opts.dry_run {\n        for (req, desired) in &todo {\n            // template state wasn't computed (no rendering on dry runs), so\n            // the entry may already be converged\n            let conditional =\n                desired.is_none() && matches!(&req.op, EditOp::Block { template: true, .. });\n            let suffix = if conditional { \" (if changed)\" } else { \"\" };\n            miseprintln!(\n                \"edit {} ({}){suffix}\",\n                req.path.display_user(),","sourceCodeStart":671,"sourceCodeEnd":707,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/edits.rs#L671-L707","documentation":"Before applying, `apply` validates every `[dotfiles]` entry and collects the problems reported by per-entry resolution (mutually exclusive fields, unknown values, marker conflicts, and so on). If any problems were found it bails with an aggregated message listing the offending entries and refuses to modify any files, so the user can fix the entries manually rather than having apply skip or partially write edits.","triggerScenarios":"Running an apply variant (e.g. `mise edits apply`) while one or more entries in the config fail validation in `resolve_entry`, or a target file's current content cannot be reconciled with the desired edit. All collected problem strings are joined and raised at src/system/edits.rs:689.","commonSituations":"Users upgrade mise and old entries with now-invalid fields (bad template, position-with-block, newline in line) suddenly block the whole apply; a mis-edited config after manual tweaking; an entry whose marker region in the target file was deleted or corrupted by hand.","solutions":["Read each listed problem line and fix the corresponding entry in your config (remove conflicting fields, correct values).","Manually repair the target file if the problem is about reconciling existing content (e.g. restore or delete the stale marker region).","Remove entries you no longer want.","Re-run the apply command; it should proceed or report only remaining problems."],"exampleFix":"# before (config with a problem entry)\n[dotfiles.\"~/.zshrc\".broken]\nline = \"export FOO=1\"\nblock = \"export BAR=2\"\n\n# after\n[dotfiles.\"~/.zshrc\".broken]\nline = \"export FOO=1\"","handlingStrategy":"try-catch","validationCode":"// pre-validate all entries before invoking apply\nfor (id, e) in &entries {\n    let ops = [e.block.is_some(), e.source.is_some(), e.line.is_some()].iter().filter(|b| **b).count();\n    if ops != 1 { return Err(format!(\"entry {id}: exactly one of block/source/line required\")); }\n}","typeGuard":null,"tryCatchPattern":"match mise_edits_apply() {\n    Err(e) if e.to_string().starts_with(\"edits: cannot apply these entries\") => {\n        // parse the per-entry problem list from e and fix config entries manually\n    }\n    other => other?,\n}","preventionTips":["Run `mise edits` (diff mode) before every apply to surface problem entries without touching files.","Keep one operation field and only documented option values in each entry.","After upgrading mise, re-validate existing entries against new validation rules.","Don't hand-edit marker regions in target files; let mise manage them."],"tags":["dotfiles","apply","validation"],"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"}