{"record":{"id":"afbf8260720e1c44","repo":"hashicorp/nomad","slug":"errmissingaclauthmethodname","errorCode":"errMissingACLAuthMethodName","errorMessage":"missing ACL auth-method name","messagePattern":"missing ACL auth-method name","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/acl.go","lineNumber":249,"sourceCode":"\tvar resp *OneTimeTokenExchangeResponse\n\twm, err := a.client.put(\"/v1/acl/token/onetime/exchange\", req, &resp, q)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif resp == nil {\n\t\treturn nil, nil, errors.New(\"no ACL token returned\")\n\t}\n\treturn resp.Token, wm, nil\n}\n\nvar (\n\t// errMissingACLRoleID is the generic errors to use when a call is missing\n\t// the required ACL Role ID parameter.\n\terrMissingACLRoleID = errors.New(\"missing ACL role ID\")\n\n\t// errMissingACLAuthMethodName is the generic error to use when a call is\n\t// missing the required ACL auth-method name parameter.\n\terrMissingACLAuthMethodName = errors.New(\"missing ACL auth-method name\")\n\n\t// errMissingACLBindingRuleID is the generic error to use when a call is\n\t// missing the required ACL binding rule ID parameter.\n\terrMissingACLBindingRuleID = errors.New(\"missing ACL binding rule ID\")\n)\n\n// ACLRoles is used to query the ACL Role endpoints.\ntype ACLRoles struct {\n\tclient *Client\n}\n\n// ACLRoles returns a new handle on the ACL roles API client.\nfunc (c *Client) ACLRoles() *ACLRoles {\n\treturn &ACLRoles{client: c}\n}\n\n// List is used to detail all the ACL roles currently stored within state.\nfunc (a *ACLRoles) List(q *QueryOptions) ([]*ACLRoleListStub, *QueryMeta, error) {","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/acl.go#L231-L267","documentation":"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.","triggerScenarios":"ACLAuthMethods.Create(m) with m.Name == \"\"; ACLAuthMethods.Update(m) with m.Name == \"\"; also Get(\"\") and Delete(\"\") with an empty name argument.","commonSituations":"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.","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)."],"exampleFix":"// before\n_, _, err := client.ACL().AuthMethods().Create(&api.ACLAuthMethod{Type: \"kubernetes\"}, nil)\n// after\n_, _, err := client.ACL().AuthMethods().Create(&api.ACLAuthMethod{\n    Name: \"kubernetes-prod\",\n    Type: \"kubernetes\",\n    Config: map[string]interface{}{...},\n}, nil)","handlingStrategy":"validation","validationCode":"if authMethod == nil || authMethod.Name == \"\" {\n    return fmt.Errorf(\"ACL auth-method name is required\")\n}","typeGuard":"func hasAuthMethodName(m *api.ACLAuthMethod) bool { return m != nil && m.Name != \"\" }","tryCatchPattern":null,"preventionTips":["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."],"tags":["consul","acl","auth-method","validation","sentinel-error"],"backgroundTag":"missing-required-argument","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}