hashicorp/nomad · error
errMissingACLAuthMethodName
errMissingACLAuthMethodName
Error message
missing ACL auth-method name
What it means
errMissingACLAuthMethodName is a shared sentinel error used by ACLAuthMethods.Create, Update, Delete(?), and Get when the required auth-method Name is an empty string. Name is part of the request path (/v1/acl/auth-method/<name>), so the client rejects empty values before issuing the request.
Source
Thrown at api/acl.go:249
var resp *OneTimeTokenExchangeResponse
wm, err := a.client.put("/v1/acl/token/onetime/exchange", req, &resp, q)
if err != nil {
return nil, nil, err
}
if resp == nil {
return nil, nil, errors.New("no ACL token returned")
}
return resp.Token, wm, nil
}
var (
// errMissingACLRoleID is the generic errors to use when a call is missing
// the required ACL Role ID parameter.
errMissingACLRoleID = errors.New("missing ACL role ID")
// errMissingACLAuthMethodName is the generic error to use when a call is
// missing the required ACL auth-method name parameter.
errMissingACLAuthMethodName = errors.New("missing ACL auth-method name")
// errMissingACLBindingRuleID is the generic error to use when a call is
// missing the required ACL binding rule ID parameter.
errMissingACLBindingRuleID = errors.New("missing ACL binding rule ID")
)
// ACLRoles is used to query the ACL Role endpoints.
type ACLRoles struct {
client *Client
}
// ACLRoles returns a new handle on the ACL roles API client.
func (c *Client) ACLRoles() *ACLRoles {
return &ACLRoles{client: c}
}
// List is used to detail all the ACL roles currently stored within state.
func (a *ACLRoles) List(q *QueryOptions) ([]*ACLRoleListStub, *QueryMeta, error) {View on GitHub (pinned to 482b49bf1a)
Solutions
- Set authMethod.Name to a non-empty identifier before Create/Update.
- Pass the actual auth-method name string to Get/Delete, sourced from `consul acl auth-method list` or your config.
- Validate the name in your caller (e.g. fail fast if os.Getenv("AUTH_METHOD") is empty).
Example fix
// before
_, _, err := client.ACL().AuthMethods().Create(&api.ACLAuthMethod{Type: "kubernetes"}, nil)
// after
_, _, err := client.ACL().AuthMethods().Create(&api.ACLAuthMethod{
Name: "kubernetes-prod",
Type: "kubernetes",
Config: map[string]interface{}{...},
}, nil) Defensive patterns
Strategy: validation
Validate before calling
if authMethod == nil || authMethod.Name == "" {
return fmt.Errorf("ACL auth-method name is required")
} Type guard
func hasAuthMethodName(m *api.ACLAuthMethod) bool { return m != nil && m.Name != "" } Prevention
- Validate auth-method definitions parsed from HCL/YAML for a non-empty Name before submitting.
- Centralize auth-method constants instead of free-form strings from config.
- Use `consul acl auth-method list` to confirm exact names.
When it happens
Trigger: ACLAuthMethods.Create(m) with m.Name == ""; ACLAuthMethods.Update(m) with m.Name == ""; also Get("") and Delete("") with an empty name argument.
Common situations: Building an ACLAuthMethod from config (e.g. Kubernetes or JWT auth setup) where the Name field was omitted in HCL/JSON; passing an empty string variable for the name in Get/Delete; YAML key typo leaving Name unset.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- errMissingACLRoleID
- errMissingACLBindingRuleID
- cannot specify ACL role ID
- missing ACL role name
- default ACL auth method already exists: %v
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/afbf8260720e1c44.
Report an issue: GitHub.