{"record":{"id":"a9b2ae5fac9b1dae","repo":"jdx/mise","slug":"bootstrap-resource-resource-requires-owner-o","errorCode":null,"errorMessage":"bootstrap resource '{resource}' requires owner '{owner}', but that user is absent","messagePattern":"bootstrap resource '(.+?)' requires owner '(.+?)', but that user is absent","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/resources.rs","lineNumber":640,"sourceCode":"\nfn add_account_dependencies(\n    plan: &mut BootstrapPlan,\n    resource: &ResourceId,\n    state: super::managed_files::ManagedState,\n    owner: Option<&str>,\n    group: Option<&str>,\n    user_states: &HashMap<String, super::accounts::AccountState>,\n    group_states: &HashMap<String, super::accounts::AccountState>,\n) -> Result<()> {\n    if state != super::managed_files::ManagedState::Present {\n        return Ok(());\n    }\n    if let Some(owner) = owner {\n        match user_states.get(owner) {\n            Some(super::accounts::AccountState::Present) => {\n                plan.add_dependency(resource, ResourceId::new(\"user\", owner))?;\n            }\n            Some(super::accounts::AccountState::Absent) => bail!(\n                \"bootstrap resource '{resource}' requires owner '{owner}', but that user is absent\"\n            ),\n            None => {}\n        }\n    }\n    if let Some(group) = group {\n        match group_states.get(group) {\n            Some(super::accounts::AccountState::Present) => {\n                plan.add_dependency(resource, ResourceId::new(\"group\", group))?;\n            }\n            Some(super::accounts::AccountState::Absent) => bail!(\n                \"bootstrap resource '{resource}' requires group '{group}', but that group is absent\"\n            ),\n            None => {}\n        }\n    }\n    Ok(())\n}","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/resources.rs#L622-L658","documentation":"While wiring account dependencies for bootstrap resources, the planner checks the computed state of the owner user. If the owner account is explicitly managed as Absent, the resource cannot be created with that owner, so planning fails with this message instead of producing a plan that would apply unsuccessfully at runtime.","triggerScenarios":"Calling plan (via add_account_dependencies) for a bootstrap resource whose owner field names a user whose AccountState in user_states is Absent — i.e. a user resource in the same plan declares that account as absent.","commonSituations":"Setting owner: deploy on a file/service resource while another section removes the 'deploy' user; renaming an account in one place but not the other; inheriting shared config that deletes service accounts still referenced by file owners.","solutions":["Change the owner to an existing/present user, or update the user resource state to Present.","Remove the user-removal declaration if the account should actually exist.","If the whole stack is being torn down, also mark the dependent resources absent so no owner is required.","Fix the owner string if it is a typo for a user that is present."],"exampleFix":"// before\nuser(\"deploy\", AccountState::Absent);\nresource(\"/srv/app\", owner: \"deploy\");\n// after\nuser(\"deploy\", AccountState::Present);\nresource(\"/srv/app\", owner: \"deploy\");","handlingStrategy":"validation","validationCode":"fn owner_ok(owner: &str, user_states: &std::collections::HashMap<String, bool>) -> Result<(), String> {\n    match user_states.get(owner) {\n        Some(true) => Ok(()),\n        Some(false) => Err(format!(\"owner '{owner}' is declared absent\")),\n        None => Err(format!(\"owner '{owner}' is not declared at all\")),\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whenever you remove a user, grep resource configs for it as owner/group before committing","Centralize account names in constants so removals fail fast at review","Plan on a fixture before applying to surface owner/account contradictions","Keep account lifecycle (create/remove) and resource ownership in the same module"],"tags":["users","ownership","planning"],"backgroundTag":"missing-dependency","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}