{"record":{"id":"b171316b90ee292f","repo":"nats-io/nats-server","slug":"message-ttl-disabled","errorCode":null,"errorMessage":"message TTL disabled","messagePattern":"message TTL disabled","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/stream.go","lineNumber":6378,"sourceCode":"\t\tif !traceOnly {\n\t\t\thdr = setHeader(MsgTraceDest, MsgTraceDestDisabled, hdr)\n\t\t}\n\t\t// This will add the jetstream event while in the client read loop.\n\t\t// Since the event will be updated in a different go routine, the\n\t\t// tracing object will have a separate reference to the JS trace\n\t\t// object.\n\t\tmt.addJetStreamEvent(mset.name())\n\t}\n\tmset.queueInbound(mset.msgs, subject, reply, hdr, msg, nil, c.pa.trace)\n}\n\nvar (\n\terrLastSeqMismatch   = errors.New(\"last sequence mismatch\")\n\terrMsgIdDuplicate    = errors.New(\"msgid is duplicate\")\n\terrStreamClosed      = errors.New(\"stream closed\")\n\terrInvalidMsgHandler = errors.New(\"undefined message handler\")\n\terrStreamMismatch    = errors.New(\"expected stream does not match\")\n\terrMsgTTLDisabled    = errors.New(\"message TTL disabled\")\n)\n\n// processJetStreamMsg is where we try to actually process the stream msg.\n// needIsolation should be false only if the caller already holds isolateMu\n// across a whole atomic batch; mset.mu must NOT be held by the caller.\nfunc (mset *stream) processJetStreamMsg(subject, reply string, hdr, msg []byte, lseq uint64, ts int64, mt *msgTrace, sourced bool, needIsolation bool) error {\n\treturn mset.processJetStreamMsgWithBatch(subject, reply, hdr, msg, lseq, ts, mt, sourced, needIsolation, nil)\n}\n\nfunc (mset *stream) processJetStreamMsgWithBatch(subject, reply string, hdr, msg []byte, lseq uint64, ts int64, mt *msgTrace, sourced bool, needIsolation bool, fastBatch *FastBatch) (retErr error) {\n\tif mt != nil {\n\t\t// Only the leader/standalone will have mt!=nil. On exit, send the\n\t\t// message trace event.\n\t\tdefer func() {\n\t\t\tmt.sendEventFromJetStream(retErr)\n\t\t}()\n\t}\n","sourceCodeStart":6360,"sourceCodeEnd":6396,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/stream.go#L6360-L6396","documentation":"errMsgTTLDisabled: the message carries a Message-TTL (or scheduled-message TTL) header, but the stream does not have message TTLs enabled (allow_msg_ttl off), so the publish is rejected with the JS message-TTL-disabled API error.","triggerScenarios":"Thrown at server/stream.go:6378 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable allow_msg_ttl (and related TTL settings) on the stream","Remove the Message-TTL header from publishes to that stream","Use stream-level max_age if blanket expiry is acceptable"],"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"}