{"record":{"id":"ec10227af668d6e9","repo":"dotnetcore/CAP","slug":"nats-message-send-failed-no-consumer-reply","errorCode":null,"errorMessage":"NATS message send failed, no consumer reply!","messagePattern":"NATS message send failed, no consumer reply!","errorType":"exception","errorClass":"PublisherSentFailedException","httpStatus":null,"severity":"error","filePath":"src/DotNetCore.CAP.NATS/ITransport.NATS.cs","lineNumber":56,"sourceCode":"            foreach (var header in message.Headers)\n            {\n                msg.Header[header.Key] = header.Value;\n            }\n\n            var js = connection.CreateJetStreamContext(_jetStreamOptions);\n\n            var builder = PublishOptions.Builder().WithMessageId(message.GetId());\n\n            var resp = await js.PublishAsync(msg, builder.Build());\n\n            if (resp.Seq > 0)\n            {\n                _logger.LogDebug($\"NATS stream message [{message.GetName()}] has been published.\");\n\n                return OperateResult.Success;\n            }\n\n            throw new PublisherSentFailedException(\"NATS message send failed, no consumer reply!\");\n        }\n        catch (Exception ex)\n        {\n            var warpEx = new PublisherSentFailedException(ex.Message, ex);\n\n            return OperateResult.Failed(warpEx);\n        }\n        finally\n        {\n            _connectionPool.Return(connection);\n        }\n    }\n}","sourceCodeStart":38,"sourceCodeEnd":69,"githubUrl":"https://github.com/dotnetcore/CAP/blob/e52b8508e54cdb7a9ce7f9fec03d9ea8ad2710fb/src/DotNetCore.CAP.NATS/ITransport.NATS.cs#L38-L69","documentation":"A generic sentinel thrown by the NATS transport's SendAsync when a JetStream PublishAsync completes without a confirmed sequence number (resp.Seq == 0), meaning the message was not acknowledged by the stream — usually because the stream/consumer bound to the subject does not exist or is not properly configured. The input at fault is the JetStream subject derived from the message name.","triggerScenarios":"Thrown at src/DotNetCore.CAP.NATS/ITransport.NATS.cs:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the JetStream stream that captures the publish subject exists (create it via nats stream add or programmatically) before publishing.","Verify _jetStreamOptions and the stream subject mapping cover the message name being published to.","Check the NATS connection and account permissions; a publish to a subject with no interest or insufficient rights yields no ack, triggering this error."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e52b8508e54cdb7a9ce7f9fec03d9ea8ad2710fb","analyzedAt":"2026-09-14T14:46:34.677Z","contentChangedAt":"2026-09-14T14:46:34.677Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}