{"record":{"id":"cfdbd3d41bb090ce","repo":"nats-io/nats-server","slug":"queue-q-is-not-a-valid-queue","errorCode":null,"errorMessage":"queue %q is not a valid queue","messagePattern":"queue %q is not a valid queue","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/opts.go","lineNumber":5065,"sourceCode":"\t}\n\treturn p, nil\n}\n\n// Helper function to validate permissions subjects.\nfunc checkPermSubjectArray(sa []string, allowQueue bool) error {\n\tfor _, s := range sa {\n\t\tif !IsValidSubject(s) {\n\t\t\tif !allowQueue {\n\t\t\t\treturn fmt.Errorf(\"subject %q is not a valid subject\", s)\n\t\t\t}\n\t\t\t// Check here if this is a queue group qualified subject.\n\t\t\telements := strings.Fields(s)\n\t\t\tif len(elements) != 2 {\n\t\t\t\treturn fmt.Errorf(\"subject %q is not a valid subject\", s)\n\t\t\t} else if !IsValidSubject(elements[0]) {\n\t\t\t\treturn fmt.Errorf(\"subject %q is not a valid subject\", elements[0])\n\t\t\t} else if !IsValidSubject(elements[1]) {\n\t\t\t\treturn fmt.Errorf(\"queue %q is not a valid queue\", elements[1])\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// PrintTLSHelpAndDie prints TLS usage and exits.\nfunc PrintTLSHelpAndDie() {\n\tfmt.Printf(\"%s\", tlsUsage)\n\tfor k := range cipherMap {\n\t\tfmt.Printf(\"    %s\\n\", k)\n\t}\n\tfmt.Printf(\"\\nAvailable curve preferences include:\\n\")\n\tfor k := range curvePreferenceMap {\n\t\tfmt.Printf(\"    %s\\n\", k)\n\t}\n\tif runtime.GOOS == \"windows\" {\n\t\tfmt.Printf(\"%s\\n\", certstore.Usage)","sourceCodeStart":5047,"sourceCodeEnd":5083,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/opts.go#L5047-L5083","documentation":"This error comes from NATS server option validation when parsing a colon-separated queue subscription string ('subject:queue') supplied in options (e.g. service imports/exports or queue placeholders). It means the second element, the queue/group name, is not a valid NATS subject token per IsValidSubject. The library rejects it early so an invalid queue name never reaches the routing layer.","triggerScenarios":"Calling ProcessOptions/Parse with a config entry containing 'subject:queue' where the part after the first ':' contains wildcards ('*','>'), invalid characters (spaces, ':', non-ASCII), or is empty.","commonSituations":"Typos in queue group names in nats-server config files; accidentally passing a full multi-token subject where a queue name is expected; copying a subscription string like 'foo.bar.*:workers' where '*' is invalid in a queue name.","solutions":["Replace the queue portion with a valid subject token (letters, digits, '-', '_', '.', no wildcards or spaces)","Check the config file line for stray whitespace or special characters in the queue name","Validate the string with server.IsValidSubject(elements[1]) before handing it to the options parser"],"exampleFix":"// before: 'foo.bar.*:my queue'  -> invalid queue\n// after\nsrv, err := server.NewServer(&server.Options{\n  // valid queue token\n  // e.g. 'foo.bar:workers'\n})","handlingStrategy":"validation","validationCode":"for _, part := range strings.Split(s, \":\") {\n  if !server.IsValidSubject(part) {\n    return fmt.Errorf(\"invalid subject/queue token %q\", part)\n  }\n}","typeGuard":"func isValidQueue(q string) bool { return q != \"\" && server.IsValidSubject(q) }","tryCatchPattern":null,"preventionTips":["Never use wildcards (*, >) or spaces in queue group names","Validate subject:queue strings at config-load time","Keep queue names simple alphanumeric tokens"],"tags":["nats","config-validation","subject"],"backgroundTag":"invalid-nats-subject","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}