t8y2/dbx · error
ETCD_%s_REQUIRED
ETCD_%s_REQUIRED
Error message
ETCD_%s_REQUIRED
What it means
requiredString builds a per-field error of the form ETCD_<FIELD>_REQUIRED (field uppercased) when a mandatory string parameter is missing, null, or empty in the JSON-RPC params. It backs the auth methods: authUserGet, authUserAdd, authUserDelete, authUserChangePassword, authUserGrantRevokeRole, authRoleGet.
Source
Thrown at agents/drivers/etcd2-go/kv.go:521
return value
}
func longOrNull(params map[string]json.RawMessage, key string) *int64 {
raw := params[key]
if len(raw) == 0 || string(raw) == "null" {
return nil
}
var value int64
if err := json.Unmarshal(raw, &value); err != nil {
return nil
}
return &value
}
func requiredString(params map[string]json.RawMessage, field string) (string, error) {
value := stringOrNull(params, field)
if value == nil || *value == "" {
return "", fmt.Errorf("ETCD_%s_REQUIRED", strings.ToUpper(field))
}
return *value, nil
}
View on GitHub (pinned to c0390bff16)
Solutions
- Read the field name from the error code and supply a non-empty value for it.
- Validate the params object client-side before invoking the auth method.
- Ensure your client sends JSON strings, not null, for required fields.
Example fix
// before
authUserAdd({"password": "s3cret"})
// after
authUserAdd({"user": "alice", "password": "s3cret"}) Defensive patterns
Strategy: validation
Validate before calling
for _, f := range []string{"user", "password"} {
if v, ok := params[f].(string); !ok || v == "" { return fmt.Errorf("field %s must be a non-empty string", f) }
} Type guard
func nonEmptyString(p map[string]json.RawMessage, key string) bool {
var s string
return json.Unmarshal(p[key], &s) == nil && s != ""
} Try / catch
if err := authUserAdd(params); err != nil {
var codeErr struct{ Code string }
if strings.HasPrefix(err.Error(), "ETCD_") && strings.HasSuffix(err.Error(), "_REQUIRED") {
field := strings.ToLower(strings.TrimSuffix(strings.TrimPrefix(err.Error(), "ETCD_"), "_REQUIRED"))
return fmt.Errorf("missing required field: %s", field)
}
} Prevention
- Build auth RPC payloads from a typed struct so missing fields fail at compile time
- Never default required auth fields to empty string
- Unit-test each auth method's payload schema
When it happens
Trigger: Calling e.g. authUserAdd without a 'user' field, authChangePassword without 'password', or passing "" for any required field — the message interpolates the field name (e.g. ETCD_USER_REQUIRED, ETCD_PASSWORD_REQUIRED).
Common situations: Partially filled RPC payloads, empty-string defaults sent by client tooling, omitted optional-looking fields that are actually mandatory for auth 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
- user is required
- Key is required
- agentSessionId is required
- ETCD_DEFRAG_TARGET_REQUIRED
- ETCD_NEWKEY_REQUIRED
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/b6c5bdc2a6993fd8.
Report an issue: GitHub.