t8y2/dbx · error
user name is required
Error message
user name is required
What it means
userName resolves the target RabbitMQ user from the "name" param, falling back to "user". If both are empty or whitespace, the operation (createUser, deleteUser, grantPermission, revokePermission) cannot proceed and this error is thrown, since every user-scoped operation needs a concrete user.
Source
Thrown at agents/drivers/rabbitmq/operations.go:982
func permissionVhost(params jsonObject) (string, error) {
vhost := stringOrEmpty(params, "virtual_host")
if strings.TrimSpace(vhost) == "" {
return "", errors.New("virtual_host is required")
}
if vhost == "*" {
return "", errors.New("all_vhosts is only supported for list operations")
}
return vhost, nil
}
func userName(params jsonObject) (string, error) {
name := stringOrEmpty(params, "name")
if strings.TrimSpace(name) == "" {
name = stringOrEmpty(params, "user")
}
if strings.TrimSpace(name) == "" {
return "", errors.New("user name is required")
}
return name, nil
}
func (s *server) listPolicies(params jsonObject) (any, error) {
connection, err := s.requireConnectionConfig(params)
if err != nil {
return nil, err
}
allVhosts := allVhostsRequested(params) || stringOrEmpty(params, "virtual_host") == "*"
path := "/api/policies/" + urlEncodeVhost(effectiveVhost(params, connection))
if allVhosts {
path = "/api/policies"
}
policies, err := managementGetAll(connection, path)
if err != nil {
return nil, err
}View on GitHub (pinned to c0390bff16)
Solutions
- Pass name:"<username>" to the operation
- Alternatively pass user:"<username>" (accepted fallback key)
- Check that the variable feeding the param is non-empty before dispatching
Example fix
// before
{ "op": "deleteUser", "username": "alice" } // wrong key
// after
{ "op": "deleteUser", "name": "alice" } Defensive patterns
Strategy: validation
Validate before calling
const user = (params.name ?? params.user ?? "").trim();
if (!user) throw new Error("user name is required"); Type guard
function hasUser(p) { return [p.name, p.user].some(v => typeof v === "string" && v.trim() !== ""); } Try / catch
try { await agent.dispatch("deleteUser", params); } catch (e) { if (/user name is required/.test(e.message)) { /* fill name and retry */ } else throw e; } Prevention
- Use the "name" key for user-scoped operations
- Log/echo params before dispatch to catch empty variables
- Normalize param keys in your wrapper layer
When it happens
Trigger: Calling createUser, deleteUser, grantPermission, or revokePermission with neither "name" nor "user" set, or both empty/whitespace.
Common situations: Deleting users with the wrong key (e.g. "username" or "userName"); empty variables from shell/env substitution; mixing up param naming between operations.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- virtual_host is required
- topic (queue name) is required
- namespace is required
- name is required
- password is required
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/1b4f8aa7f9a2f518.
Report an issue: GitHub.