{"record":{"id":"9f31e1f01a60dec9","repo":"nats-io/nats-server","slug":"10111-9f31e1","errorCode":"10111","errorMessage":"rollup value invalid: %q","messagePattern":"rollup value invalid: %q","errorType":"validation","errorClass":"JSStreamRollupFailedError","httpStatus":null,"severity":"error","filePath":"server/stream.go","lineNumber":6941,"sourceCode":"\t\tif rollup := getRollup(hdr); rollup != _EMPTY_ {\n\t\t\tif canConsistencyCheck && !allowRollupPurge && !sourced {\n\t\t\t\terr := errors.New(\"rollup not permitted\")\n\t\t\t\tif canRespond {\n\t\t\t\t\tresp.PubAck = &PubAck{Stream: name}\n\t\t\t\t\tresp.Error = NewJSStreamRollupFailedError(err)\n\t\t\t\t\tb, _ := json.Marshal(resp)\n\t\t\t\t\toutq.sendMsg(reply, b)\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tswitch rollup {\n\t\t\tcase JSMsgRollupSubject:\n\t\t\t\trollupSub = true\n\t\t\tcase JSMsgRollupAll:\n\t\t\t\trollupAll = true\n\t\t\tdefault:\n\t\t\t\tif canConsistencyCheck {\n\t\t\t\t\terr := fmt.Errorf(\"rollup value invalid: %q\", rollup)\n\t\t\t\t\tif canRespond {\n\t\t\t\t\t\tresp.PubAck = &PubAck{Stream: name}\n\t\t\t\t\t\tresp.Error = NewJSStreamRollupFailedError(err)\n\t\t\t\t\t\tb, _ := json.Marshal(resp)\n\t\t\t\t\t\toutq.sendMsg(reply, b)\n\t\t\t\t\t}\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif canConsistencyCheck && incr == nil && allowMsgCounter {\n\t\tapiErr := NewJSMessageIncrMissingError()\n\t\tif canRespond {\n\t\t\tresp.PubAck = &PubAck{Stream: name}\n\t\t\tresp.Error = apiErr\n\t\t\tb, _ := json.Marshal(resp)","sourceCodeStart":6923,"sourceCodeEnd":6959,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/stream.go#L6923-L6959","documentation":"A rollup publish request carried a Nats-Rollup header value that JetStream does not recognize (only JSMsgRollupSubject \"sub\" and JSMsgRollupAll \"all\" are valid). When consistency checking is possible, the server builds this error and returns it in the PubAck's Error field as a JSStreamRollupFailedError (code 10111). The odd DECLARED/USED AT metadata refers to conf/fuzz.go where a same-named 'err' variable appears in a config parser fuzzer, unrelated to the stream.go throw site.","triggerScenarios":"Publishing with msg header Nats-Rollup set to something other than 'sub' or 'all' (case-sensitive) against a stream with AllowRollupHeaders enabled.","commonSituations":"Hand-rolled header constants (e.g. 'Rollup' or 'ALL' with wrong case), proxy middleware injecting rollup headers incorrectly, or older client libraries building the header manually.","solutions":["Set the Nats-Rollup header to exactly \"sub\" or \"all\" (use library constants nats.MsgRollupSubject / nats.MsgRollupAll).","Check AllowRollupHeaders is enabled on the target stream.","Inspect the PubAck.Error / NoResponders path in your publish helper for header typos."],"exampleFix":"// before\nmsg.Header.Set(\"Nats-Rollup\", \"All\")\n// after\nmsg.Header.Set(\"Nats-Rollup\", nats.MsgRollupAll) // \"all\"","handlingStrategy":"type-guard","validationCode":"switch rollup {\ncase nats.MsgRollupSubject, nats.MsgRollupAll:\n    // ok\ndefault:\n    return fmt.Errorf(\"invalid rollup header %q\", rollup)\n}","typeGuard":"func isRollupValue(v string) bool {\n    return v == \"sub\" || v == \"all\"\n}","tryCatchPattern":"if pa.Err != nil && pa.Err.ErrorCode == 10111 { /* invalid rollup header value */ }","preventionTips":["Always use client constants (nats.MsgRollupSubject/MsgRollupAll), never raw strings.","Remember values are case-sensitive lowercase."],"tags":["jetstream","rollup","headers","validation"],"backgroundTag":"invalid-rollup-header","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}