{"record":{"id":"7b684f0b5d93696e","repo":"nats-io/nats-server","slug":"invalid-sorting-option-s","errorCode":null,"errorMessage":"invalid sorting option: %s","messagePattern":"invalid sorting option: (.+?)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/monitor.go","lineNumber":227,"sourceCode":"\t\tsubs    bool\n\t\tsubsDet bool\n\t\toffset  int\n\t\tlimit   = DefaultConnListSize\n\t\tcid     = uint64(0)\n\t\tstate   = ConnOpen\n\t\tuser    string\n\t\tacc     string\n\t\ta       *Account\n\t\tfilter  string\n\t\tmqttCID string\n\t)\n\n\tif opts != nil {\n\t\t// If no sort option given or sort is by uptime, then sort by cid\n\t\tif opts.Sort != _EMPTY_ {\n\t\t\tsortOpt = opts.Sort\n\t\t\tif !sortOpt.IsValid() {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid sorting option: %s\", sortOpt)\n\t\t\t}\n\t\t}\n\n\t\t// Auth specifics.\n\t\tauth = opts.Username\n\t\tuser = opts.User\n\t\tacc = opts.Account\n\t\tmqttCID = opts.MQTTClient\n\n\t\tsubs = opts.Subscriptions\n\t\tsubsDet = opts.SubscriptionsDetail\n\t\toffset = opts.Offset\n\t\tif offset < 0 {\n\t\t\toffset = 0\n\t\t}\n\t\tlimit = opts.Limit\n\t\tif limit <= 0 {\n\t\t\tlimit = DefaultConnListSize","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/monitor.go#L209-L245","documentation":"Returned by Connz when the monitoring endpoint's sort query parameter is not one of the recognized SortOption values (checked via sortOpt.IsValid). It fires before any connection data is collected, so the whole /connz request is rejected.","triggerScenarios":"Thrown at server/monitor.go:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid sort value (e.g. cid, start, subs, pending, etc.) from the SortOption set","Check the NATS monitoring API docs for the supported sort options on the running server version"],"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"}