{"record":{"id":"c87d0c039ace7ea2","repo":"hashicorp/nomad","slug":"errmissingaclbindingruleid","errorCode":"errMissingACLBindingRuleID","errorMessage":"missing ACL binding rule ID","messagePattern":"missing ACL binding rule ID","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/acl.go","lineNumber":253,"sourceCode":"\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) {\n\tvar resp []*ACLRoleListStub\n\tqm, err := a.client.query(\"/v1/acl/roles\", &resp, q)\n\tif err != nil {\n\t\treturn nil, nil, err","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/acl.go#L235-L271","documentation":"errMissingACLBindingRuleID is a shared sentinel error used by ACLBindingRules.Update, Delete, and Get when the required binding rule ID is an empty string. Binding rule IDs are used in the request path (/v1/acl/binding-rule/<id>), so the client rejects empty values locally before any HTTP request.","triggerScenarios":"ACLBindingRules.Update(rule) with rule.ID == \"\"; ACLBindingRules.Delete(\"\"); ACLBindingRules.Get(\"\") — any binding-rule call with an empty ID.","commonSituations":"Creating an ACLBindingRule struct (only AuthMethod/Selector/BindType set) and then passing it to Update without an ID; copying code from a Create path to an Update path; reading the rule ID from an empty config value.","solutions":["Set bindingRule.ID to the rule's UUID before calling Update (list rules via ACLBindingRules.List and match by selector/method to find it).","Pass the actual rule UUID, not the auth-method name, to Delete/Get.","Validate the ID is non-empty in your caller before invoking these methods."],"exampleFix":"// before\nrule := &api.ACLBindingRule{AuthMethod: \"kubernetes\", BindType: \"service\", BindName: \"web\"}\n_, _, err := client.ACL().BindingRules().Update(rule, nil)\n// after\nrules, _, err := client.ACL().BindingRules().List(nil)\n// find the rule, set its ID\nfor _, r := range rules {\n    if r.AuthMethod == \"kubernetes\" {\n        rule.ID = r.ID\n        break\n    }\n}\n_, _, err = client.ACL().BindingRules().Update(rule, nil)","handlingStrategy":"validation","validationCode":"if rule == nil || rule.ID == \"\" {\n    return fmt.Errorf(\"ACL binding rule ID is required for update/delete/get\")\n}","typeGuard":"func hasBindingRuleID(r *api.ACLBindingRule) bool { return r != nil && r.ID != \"\" }","tryCatchPattern":null,"preventionTips":["List binding rules and match on AuthMethod/Selector to resolve the ID before Update/Delete.","Store binding rule IDs returned at creation time in your state/config.","Never pass auth-method name where a rule UUID is expected."],"tags":["consul","acl","binding-rule","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"}