{"record":{"id":"7c4ca4a8633ed5fd","repo":"jdx/mise","slug":"present-bootstrap-user-name-requires-a-primary","errorCode":null,"errorMessage":"present bootstrap user '{name}' requires a primary group","messagePattern":"present bootstrap user '(.+?)' requires a primary group","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/accounts.rs","lineNumber":333,"sourceCode":"                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\n            && (config.uid.is_some()\n                || config.group.is_some()\n                || config.groups.is_some()\n                || config.exclusive_groups\n                || config.home.is_some()\n                || config.shell.is_some()\n                || config.comment.is_some()\n                || config.system\n                || config.create_home.is_some()\n                || config.move_home)\n        {\n            bail!(\"absent bootstrap user '{name}' may only set state and remove_home\");\n        }","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/accounts.rs#L315-L351","documentation":"UserRequest::from_toml requires that a bootstrap user with state = \"present\" declares a primary group (config.group). A POSIX user cannot be created without a primary group, and mise does not guess defaults (no implicit 'create a same-name group'), so the config is rejected at parse time with the user's name in the message.","triggerScenarios":"A [bootstrap.users.<name>] table with state = \"present\" and no group = \"...\" key, loaded during `mise bootstrap plan`/`apply` or any account-request build.","commonSituations":"Copy-pasting an absent-user template and flipping state to present; assuming mise auto-creates a matching group; migrating from a system that lets the primary group default.","solutions":["Add group = \"<name>\" (or an existing group) to the present user entry.","If that group does not exist yet, also declare it under [bootstrap.groups.<name>] or reference a group that already exists on the host.","Re-run `mise bootstrap plan` to confirm validation passes."],"exampleFix":"# before\n[bootstrap.users.jenkins]\nstate = \"present\"\n# after\n[bootstrap.users.jenkins]\nstate = \"present\"\ngroup = \"jenkins\"\n\n[bootstrap.groups.jenkins]\nstate = \"present\"","handlingStrategy":"validation","validationCode":"python3 - <<'EOF'\nimport sys, tomllib\ncfg = tomllib.load(open('mise.toml','rb'))\nfor name, u in cfg.get('bootstrap', {}).get('users', {}).items():\n    if u.get('state') == 'present' and 'group' not in u:\n        sys.exit(f\"present user '{name}' requires a primary group\")\nEOF","typeGuard":"def present_user_has_group(u: dict) -> bool:\n    return 'group' in u if u.get('state') == 'present' else True","tryCatchPattern":null,"preventionTips":["Start every present-user entry from a template that includes group.","Declare the primary group under [bootstrap.groups] unless it already exists on every host.","Validate with `mise bootstrap plan` before apply."],"tags":["mise","bootstrap","users","config-validation","groups","toml"],"backgroundTag":"config-validation-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}