{"record":{"id":"2452933e5b4ca114","repo":"jdx/mise","slug":"group-update-requires-a-desired-gid","errorCode":null,"errorMessage":"group update requires a desired gid","messagePattern":"group update requires a desired gid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/accounts.rs","lineNumber":320,"sourceCode":"            }\n        }\n    }\n\n    fn action(&self) -> Result<Option<AccountAction>> {\n        match self.plan().action {\n            ResourceAction::Noop => Ok(None),\n            ResourceAction::Unknown => bail!(\n                \"refusing unsafe change to bootstrap group '{}'; inspect `mise bootstrap plan`\",\n                self.name\n            ),\n            ResourceAction::Create => Ok(Some(AccountAction::CreateGroup {\n                name: self.name.clone(),\n                gid: self.gid,\n                system: self.system,\n            })),\n            ResourceAction::Update => Ok(Some(AccountAction::UpdateGroup {\n                name: self.name.clone(),\n                gid: self.gid.expect(\"group update requires a desired gid\"),\n            })),\n            ResourceAction::Remove => Ok(Some(AccountAction::RemoveGroup {\n                name: self.name.clone(),\n            })),\n        }\n    }\n}\n\nimpl UserRequest {\n    fn from_toml(name: String, config: UserTomlConfig) -> Result<Self> {\n        validate_name(\"user\", &name)?;\n        if config.state == AccountState::Present && config.group.is_none() {\n            bail!(\"present bootstrap user '{name}' requires a primary group\");\n        }\n        if config.state == AccountState::Present && config.remove_home {\n            bail!(\"present bootstrap user '{name}' must not set remove_home\");\n        }\n        if config.state == AccountState::Absent","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/accounts.rs#L302-L338","documentation":"In src/system/accounts.rs, a group resource being updated must carry a desired gid. When converting a planned group change into an AccountAction::UpdateGroup, gid.expect fires if the update plan has no target gid — the caller built an Update action without specifying what gid the group should have.","triggerScenarios":"A system package/config (e.g. mise system accounts/group management) declares a group with an 'update' action but omits the gid field, so plan_account_actions produces UpdateGroup with gid: None.","commonSituations":"Config declaring an existing group to manage but forgetting gid; renaming/merging group configs where the gid was dropped; schema allowing update actions without requiring gid.","solutions":["Add the desired gid to the group resource configuration so the update action has a concrete target.","Use a create action (with gid) instead of update if the group does not yet exist.","Drop the update action and manage the group outside mise if you only need membership checks.","Report a schema/validation gap if the config format permits gid-less update actions."],"exampleFix":"// before\n[[groups]]\nname = \"devs\"\naction = \"update\"\n// after\n[[groups]]\nname = \"devs\"\naction = \"update\"\ngid = 1500","handlingStrategy":"validation","validationCode":"# validate group config before applying\nif g.action == \"update\" and not g.get(\"gid\"):\n    raise ValueError(f\"group {g['name']}: update requires gid\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always specify gid for update actions on managed groups.","Lint account/group configs for required fields per action type.","Prefer create actions with explicit gids over partially-specified updates."],"tags":["accounts","groups","config","missing-field"],"backgroundTag":"missing-required-config-field","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"}