{"record":{"id":"60378fda457b59f2","repo":"nats-io/nats-server","slug":"publish-allow-w","errorCode":null,"errorMessage":"publish allow: %w","messagePattern":"publish allow: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/auth.go","lineNumber":1735,"sourceCode":"\t}\n\tfor _, u := range o.Nkeys {\n\t\tif err := validateAllowedConnectionTypes(u.AllowedConnectionTypes); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := validatePermissionSubjects(u.Permissions); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid permissions for nkey %q: %w\", u.Nkey, err)\n\t\t}\n\t}\n\treturn validateNoAuthUser(o, o.NoAuthUser)\n}\n\nfunc validatePermissionSubjects(p *Permissions) error {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tif p.Publish != nil {\n\t\tif err := checkPermSubjectArray(p.Publish.Allow, false); err != nil {\n\t\t\treturn fmt.Errorf(\"publish allow: %w\", err)\n\t\t}\n\t\tif err := checkPermSubjectArray(p.Publish.Deny, false); err != nil {\n\t\t\treturn fmt.Errorf(\"publish deny: %w\", err)\n\t\t}\n\t}\n\tif p.Subscribe != nil {\n\t\tif err := checkPermSubjectArray(p.Subscribe.Allow, true); err != nil {\n\t\t\treturn fmt.Errorf(\"subscribe allow: %w\", err)\n\t\t}\n\t\tif err := checkPermSubjectArray(p.Subscribe.Deny, true); err != nil {\n\t\t\treturn fmt.Errorf(\"subscribe deny: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateAllowedConnectionTypes(m map[string]struct{}) error {\n\tfor ct := range m {","sourceCodeStart":1717,"sourceCodeEnd":1753,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/auth.go#L1717-L1753","documentation":"Inside validatePermissionSubjects: checkPermSubjectArray rejected one of the publish allow subjects in a Permissions block; this wrapper names the section (publish allow) and propagates the underlying subject validation error.","triggerScenarios":"Thrown at server/auth.go:1735 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped error to find the bad subject","Fix or remove the invalid entry in the publish allow list","Validate subject strings against NATS subject rules before configuring"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}