{"record":{"id":"d67e8d06c6c72b4a","repo":"jdx/mise","slug":"bootstrap-files-absent-files-must-not-decl","errorCode":null,"errorMessage":"[bootstrap.files].\"{}\": absent files must not declare source or content","messagePattern":"\\[bootstrap\\.files\\]\\.\"(.+?)\": absent files must not declare source or content","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/managed_files.rs","lineNumber":617,"sourceCode":"                )\n            }\n            (Some(source), None, ManagedState::Present) => {\n                let source = resolve_source_path(base, &source);\n                Some(fs::read_to_string(&source).wrap_err_with(|| {\n                    format!(\n                        \"[bootstrap.files].\\\"{}\\\": failed to read source {}\",\n                        path.display(),\n                        source.display()\n                    )\n                })?)\n            }\n            (None, Some(content), ManagedState::Present) => Some(content),\n            (None, None, ManagedState::Present) => bail!(\n                \"[bootstrap.files].\\\"{}\\\": present files require source or content\",\n                path.display()\n            ),\n            (None, None, ManagedState::Absent) => None,\n            (_, _, ManagedState::Absent) => bail!(\n                \"[bootstrap.files].\\\"{}\\\": absent files must not declare source or content\",\n                path.display()\n            ),\n        };\n        if config.template {\n            let rendered = content\n                .as_deref()\n                .map(|content| secrets.render(root_config, content, base, &path, &origin.config))\n                .transpose()\n                .wrap_err_with(|| {\n                    format!(\n                        \"[bootstrap.files].\\\"{}\\\": failed to render template\",\n                        path.display()\n                    )\n                })?;\n            content = rendered;\n        }\n        Ok(Self {","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/managed_files.rs#L599-L635","documentation":"The mirror of the previous case: a file declared state = \"absent\" is only being removed, so attaching a body makes no sense. from_toml bails via the catch-all (_, _, ManagedState::Absent) arm when an absent file declares source or content.","triggerScenarios":"Parsing a [bootstrap.files] entry with state = \"absent\" where `source` and/or `content` is Some.","commonSituations":"Flipping an existing present-file entry to absent to decommission it while leaving its old content/source keys in place; bulk search-replace of state without pruning content.","solutions":["Remove the `content` and `source` keys from the absent file entry.","Keep the body definition in a separate commented-out or versioned entry if it may return later."],"exampleFix":"# before\n[bootstrap.files.\"/etc/old.conf\"]\ncontent = \"stale\"\nstate = \"absent\"\n\n# after\n[bootstrap.files.\"/etc/old.conf\"]\nstate = \"absent\"","handlingStrategy":"validation","validationCode":"// rust\nfn validate_absent(entry: &FileEntry) -> Result<(), &'static str> {\n    if entry.state == State::Absent && (entry.source.is_some() || entry.content.is_some()) {\n        return Err(\"absent files must not declare source or content\");\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When flipping state to absent, delete the content/source keys at the same time.","Model absent files with a dedicated type (e.g. RemovedFile { path }) that has no body field.","Add a schema enum: present requires body, absent forbids it."],"tags":["config-validation","managed-files","mutually-exclusive"],"backgroundTag":"conflicting-config-options","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"}