{"record":{"id":"e3705eb9f045603e","repo":"nats-io/nats-server","slug":"sublist-invalid-subject","errorCode":null,"errorMessage":"sublist: invalid subject","messagePattern":"sublist: invalid subject","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/sublist.go","lineNumber":43,"sourceCode":"\n// Sublist is a routing mechanism to handle subject distribution and\n// provides a facility to match subjects from published messages to\n// interested subscribers. Subscribers can have wildcard subjects to\n// match multiple published subjects.\n\n// Common byte variables for wildcards and token separator.\nconst (\n\tpwc   = '*'\n\tpwcs  = \"*\"\n\tfwc   = '>'\n\tfwcs  = \">\"\n\ttsep  = \".\"\n\tbtsep = '.'\n)\n\n// Sublist related errors\nvar (\n\tErrInvalidSubject    = errors.New(\"sublist: invalid subject\")\n\tErrNotFound          = errors.New(\"sublist: no matches found\")\n\tErrNilChan           = errors.New(\"sublist: nil channel\")\n\tErrAlreadyRegistered = errors.New(\"sublist: notification already registered\")\n)\n\nconst (\n\t// cacheMax is used to bound limit the frontend cache\n\tslCacheMax = 1024\n\t// If we run a sweeper we will drain to this count.\n\tslCacheSweep = 256\n\t// plistMin is our lower bounds to create a fast plist for Match.\n\tplistMin = 256\n)\n\n// SublistResult is a result structure better optimized for queue subs.\ntype SublistResult struct {\n\tpsubs []*subscription\n\tqsubs [][]*subscription // don't make this a map, too expensive to iterate","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/sublist.go#L25-L61","documentation":"Generic sublist guard: the subject passed to Insert/Match — e.g. an account import or mapping transformation, or a route advertisement — failed validity checks such as invalid wildcards, empty tokens, or a missing '*' at the required account token position. The offending subject string is the input at fault.","triggerScenarios":"Thrown at server/sublist.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix wildcard placement and remove empty tokens in the subject","Validate subjects with IsValidSubject before mapping or registration","Check account import/mapping subject templates for typos"],"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-08T15:18:49.778Z"}