{"record":{"id":"fe88d4cbf4f654e5","repo":"hashicorp/nomad","slug":"bind-type-is-missing","errorCode":null,"errorMessage":"bind type is missing","messagePattern":"bind type is missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/acl.go","lineNumber":2098,"sourceCode":"// Validate ensures the ACL binding rule contains valid information which meets\n// Nomad's internal requirements.\nfunc (a *ACLBindingRule) Validate() error {\n\n\tvar mErr multierror.Error\n\n\tif a.AuthMethod == \"\" {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"auth method is missing\"))\n\t}\n\tif len(a.Description) > maxACLBindingRuleDescriptionLength {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"description longer than %d\", maxACLRoleDescriptionLength))\n\t}\n\n\t// Depending on the bind type, we have some specific validation. Catching\n\t// the empty string also provides easier to understand feedback to the\n\t// user.\n\tswitch a.BindType {\n\tcase \"\":\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"bind type is missing\"))\n\tcase ACLBindingRuleBindTypeRole, ACLBindingRuleBindTypePolicy:\n\t\tif a.BindName == \"\" {\n\t\t\tmErr.Errors = append(mErr.Errors, errors.New(\"bind name is missing\"))\n\t\t}\n\tcase ACLBindingRuleBindTypeManagement:\n\t\tif a.BindName != \"\" {\n\t\t\tmErr.Errors = append(mErr.Errors, errors.New(\"bind name should be empty\"))\n\t\t}\n\tdefault:\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"unsupported bind type: %q\", a.BindType))\n\t}\n\n\t// If there is a selector configured, ensure that go-bexpr can parse this.\n\t// Otherwise, the user will get an ambiguous failure when attempting to\n\t// login.\n\tif a.Selector != \"\" {\n\t\tif _, err := bexpr.CreateEvaluator(a.Selector, nil); err != nil {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"selector is invalid: %v\", err))","sourceCodeStart":2080,"sourceCodeEnd":2116,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/acl.go#L2080-L2116","documentation":"Every ACLBindingRule must declare a BindType telling Nomad what the rule binds to (a role, a policy, or management). Validate() adds this error when BindType is empty, deliberately giving clearer feedback than a generic enum error.","triggerScenarios":"Submitting an ACLBindingRule (create/update via API or CLI) with BindType == \"\".","commonSituations":"Raw JSON payloads missing bind_type; SDK users setting only BindName; templates migrated from Vault where bind type semantics differ.","solutions":["Set BindType to ACLBindingRuleBindTypeRole (\"role\"), ACLBindingRuleBindTypePolicy (\"policy\"), or ACLBindingRuleBindTypeManagement (\"management\")","On the CLI, pass the appropriate bind-type flag","Validate the struct client-side with rule.Validate() before submitting"],"exampleFix":"// before\nrule := &structs.ACLBindingRule{\n  AuthMethod: \"okoidc\",\n  BindName: \"eng-dev\",\n}\n// after\nrule := &structs.ACLBindingRule{\n  AuthMethod: \"okoidc\",\n  BindType: structs.ACLBindingRuleBindTypePolicy,\n  BindName: \"eng-dev\",\n}","handlingStrategy":"validation","validationCode":"switch rule.BindType {\ncase structs.ACLBindingRuleBindTypeRole,\n     structs.ACLBindingRuleBindTypePolicy,\n     structs.ACLBindingRuleBindTypeManagement:\ndefault:\n    return fmt.Errorf(\"BindType must be role, policy, or management\")\n}","typeGuard":null,"tryCatchPattern":"if err := rule.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"bind type is missing\") {\n        // set rule.BindType and resubmit\n    }\n    return err\n}","preventionTips":["Use the ACLBindingRuleBindType* constants instead of raw strings","Include bind_type in all JSON/CLI payloads","Validate rules before write, especially in automation"],"tags":["nomad","acl","binding-rule","config-validation"],"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"}