{"record":{"id":"9db22ad810fc4432","repo":"jdx/mise","slug":"bootstrap-directories-recursive-is-only-va","errorCode":null,"errorMessage":"[bootstrap.directories].\"{}\": recursive is only valid with state = \"absent\"","messagePattern":"\\[bootstrap\\.directories\\]\\.\"(.+?)\": recursive is only valid with state = \"absent\"","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/managed_files.rs","lineNumber":706,"sourceCode":"        crate::file::replace_path(source)\n    } else {\n        PathBuf::from(source)\n    };\n    if source.is_absolute() {\n        source\n    } else {\n        base.join(source)\n    }\n}\n\nimpl ManagedDirectoryRequest {\n    fn from_toml(\n        path: PathBuf,\n        config: ManagedDirectoryTomlConfig,\n        origin: ResourceOrigin,\n    ) -> Result<Self> {\n        if config.state == ManagedState::Present && config.recursive {\n            bail!(\n                \"[bootstrap.directories].\\\"{}\\\": recursive is only valid with state = \\\"absent\\\"\",\n                path.display()\n            );\n        }\n        Ok(Self {\n            path,\n            phase: config.phase,\n            owner: nonempty(\"owner\", config.owner)?,\n            group: nonempty(\"group\", config.group)?,\n            mode: parse_mode(config.mode.as_deref(), 0o755)?,\n            state: config.state,\n            recursive: config.recursive,\n            replace: config.replace,\n            notify: config.notify,\n            origin,\n            inspection: None,\n        })\n    }","sourceCodeStart":688,"sourceCodeEnd":724,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/managed_files.rs#L688-L724","documentation":"ManagedDirectoryTomlConfig conversion validates that the `recursive` flag is only used with state = \"absent\": recursion controls recursive removal and is meaningless (and likely a mistake) for directory creation. from_toml bails when state is Present and recursive is true.","triggerScenarios":"Building a managed directory from TOML where the table sets both `state = \"present\"` and `recursive = true`.","commonSituations":"Copy-pasting an absent-directory entry and flipping state to present without dropping recursive; misunderstanding recursive as 'create parent directories too'.","solutions":["Remove `recursive = true` from the present-state directory entry.","If recursive removal is intended, keep recursive and set state = \"absent\" instead.","Create needed parent directories as their own present-state directory entries."],"exampleFix":"# before\n[bootstrap.directories]\n\"/var/lib/app\" = { state = \"present\", recursive = true }\n\n# after\n[bootstrap.directories]\n\"/var/lib/app\" = { state = \"present\" }","handlingStrategy":"validation","validationCode":"// rust\nfn validate_dir_entry(state: State, recursive: bool) -> Result<(), &'static str> {\n    if state == State::Present && recursive {\n        return Err(\"recursive is only valid with state = \\\"absent\\\"\");\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat recursive as a removal-only flag; document it next to state = \"absent\" examples.","When flipping an absent+recursive entry to present, always drop recursive.","Use a schema where recursive is nested under an absent-only variant."],"tags":["config-validation","managed-files","invalid-flag-combination"],"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"}