Shop is live

We build Workstation AI machines for websites, AI agents, and LLM training — configure and buy online.

Enter the shop
AI Products
AI LabsOpenAI AgentsClaude AgentsGrok BotWorkstation AI native CRMMarketingAll Products
AI Solutions
Applied AIAI AgentsGenerative AIAI AutomationAI UpskillingAI SME PackagesEnterprise AI LabAI WorkstationsNVIDIA Hardware & SoftwarePrivate AIGPU ClustersEdge AIAI by Industry
AI Services
Platform ModernisationDigital EngineeringData Foundations & AIAutonomous OperationsAI ConsultancyDevOps AutomationCyber SecuritySoftware DevelopmentAgent BuildingMLOps Setup
About Us
Our StoryPartnersCustomer Stories
AI InsightsJev seriesBenchmark LabModel selection
Articles
Documentation
ToolsWSL ProxyRing PromoterWSL VaultJobshoutSysOps 24/7
News
Blog
Contact UsSign in

AI workstations, AI Multi Agentic Software, GPU infrastructure, and intelligent agent solutions for modern businesses.

Contact Us

AI Solutions

Applied AIAI AgentsGenerative AIAI AutomationAI UpskillingAI SME PackagesEnterprise AI LabAI by Industry

Products

All ProductsWorkstation AI native CRM & ERPMarketingOpenAI AgentsWSL ProxyRing PromoterWSL VaultJobshoutSysOps 24/7

Company

About UsWhy WorkstationPartnersCustomer StoriesPricingContactTenthMatrix

Resources

AI InsightsArticlesDocumentationBlogSearchSitemap
UK Office
77-79 Marlowes, Hemel Hempstead HP1 1LFDirections - Take Junction 20 off M25 Outer LondonCompany No: 11641870Mon - Fri: 9:00 AM - 6:00 PM GMT
+44 7515 356 146
Belgium Office
Workstation SRL, Rue Vanderkindere 34, 1180 Uccle, BrusselsBE 0751.518.683Mon - Fri: 9:00 AM - 6:00 PM CET
+32 492 45 67 46
India Office
#159 Sector 9, Pocket 1, DDA Flats, 110077 Dwarka, New Delhi
+91 98881 98841

© 2026 Workstation AI. All rights reserved.

PrivacyData DeletionCookiesTerms of ServiceWebsite Sitemap

Loading blog...

Home / Blogs
Engineering

LLM Configuration Pitfalls in NATS JetStream

JobShout AI Blog Writer Agent (opens in a new window)October 6, 20267 min read
Cover

Understanding NATS JetStream's At-Least-Once Delivery Guarantee

NATS JetStream provides reliable message delivery through an at-least-once model, but this guarantee is strictly conditional on correct configuration. In at-least-once delivery systems, the system guarantees delivery by persisting messages and their delivery state until confirmation is received from the receiver [1]. This mechanism ensures that if a subscriber fails to acknowledge a message, the system will redeliver it, thereby preventing data loss.

However, this guarantee is not absolute. NATS JetStream's at-least-once delivery guarantee is conditional: five common configuration mistakes silently violate it, causing duplicate message processing, data loss, or redelivery storms with no error logged anywhere [2]. Unlike at-most-once delivery systems, where messages are ephemeral and may be missed due to network issues or lack of subscription [1], JetStream’s persistence model is robust only when configured correctly. Exactly-once delivery remains a platonic ideal that can only be asymptotically approached due to the two-phase commit problem, making at-least-once the practical standard for high-reliability systems [1].

Common Configuration Mistakes That Violate Delivery Guarantee

Despite the robustness of JetStream, five common configuration mistakes can silently violate the at-least-once delivery guarantee [2]. These errors are particularly insidious because they often result in no error being logged anywhere, making them difficult to detect through traditional monitoring [2].

  1. Misconfigured AckWait Duration:
  • The Mistake: Setting AckWait too low relative to the consumer's processing time.
  • Consequence: The consumer does not have enough time to process and acknowledge the message. JetStream assumes the message was lost and redelivers it, leading to duplicate processing.
  • Prevention: Calculate the maximum expected processing time for your consumer logic and set AckWait to a value significantly higher (e.g., 2-5x) to account for network latency and GC pauses.
  1. Unbounded MaxAckPending:
  • The Mistake: Failing to set a limit on MaxAckPending or setting it too high.
  • Consequence: A slow consumer can accumulate an unbounded number of unacknowledged messages in memory. This can lead to memory exhaustion, Out-Of-Memory (OOM) kills, or system instability.
  • Prevention: Set MaxAckPending to a value that reflects the maximum number of messages your consumer can safely hold in memory while processing. This acts as a backpressure mechanism.
  1. Incorrect FilterSubject:
  • The Mistake: Using a broad or incorrect FilterSubject that does not match the intended message routing.
  • Consequence: Messages may be delivered to the wrong consumers or, if the filter is too restrictive, not delivered to the intended consumer at all. This can lead to logical data loss or duplicate processing if multiple consumers match the same subject.
  • Prevention: Validate FilterSubject against the stream's subject mapping. Use unit tests to verify that specific test messages are routed to the correct consumer and not others.
  1. Inappropriate ReplayPolicy:
  • The Mistake: Setting ReplayPolicy to instant when a consumer is significantly behind.
  • Consequence: JetStream will deliver all pending messages as fast as possible. This can result in a burst of messages that overwhelms the processing pipeline, causing timeouts, increased AckWait violations, and subsequent redelivery storms.
  • Prevention: Use by_start_sequence or instant only when the consumer is expected to keep up. For catch-up scenarios, consider implementing rate limiting on the consumer side or using ReplayPolicy: instant with a strict MaxAckPending to throttle the flow.
  1. Ignoring InactiveThreshold:
  • The Mistake: Setting InactiveThreshold too low or ignoring it entirely.
  • Consequence: If a consumer is inactive for the specified duration, JetStream may delete the consumer. If the stream's retention policy is limits, this can lead to message loss if the consumer reconnects after the messages have been purged.
  • Prevention: Set InactiveThreshold to a value that aligns with your consumer's expected lifecycle and reconnection logic. Ensure that your consumer logic handles reconnection and resumption from the last acknowledged sequence.
Configuration Parameter Correct Setting Incorrect Setting Consequence
AckWait Sufficient for processing time Too low Premature redelivery, duplicates
MaxAckPending Bounded limit Unbounded Memory leaks, instability
FilterSubject Accurate filter Broad or incorrect Wrong delivery, loss
ReplayPolicy by_start_sequence or instant (with caution) instant (when behind) Burst overload
InactiveThreshold Aligned with consumer lifecycle Too low Consumer removal, loss

The Limitations of Prometheus NATS Exporter

Traditional monitoring tools often fall short when it comes to detecting configuration-induced delivery failures. The standard Prometheus NATS exporter exposes only server-level throughput metrics and cannot detect any of these failures [2]. This is a significant limitation because the issues described above are not related to server health or throughput but rather to the logical configuration of streams and consumers.

For example, a server may report healthy CPU and memory usage, and message throughput may appear normal, yet the system is silently dropping messages or delivering duplicates due to a misconfigured AckWait. Since the exporter does not provide visibility into the state of individual consumers or the specific configuration parameters that affect delivery guarantees, it is impossible to detect these issues using Prometheus alone. This gap in observability means that developers must rely on other methods to ensure the integrity of their message delivery pipeline.

Using LLM Observation to Prevent Delivery Failures

To address the limitations of traditional monitoring, developers can leverage Large Language Models (LLMs) to observe and analyze configuration files. LLMs can be used to parse NATS JetStream configuration files and identify potential misconfigurations that could violate delivery guarantees. By providing the LLM with the configuration file and a prompt asking it to check for common mistakes, developers can receive immediate feedback on potential issues.

This approach utilizes semantic analysis to detect logical errors that are syntactically correct but functionally flawed. For example, an LLM can be prompted to review a consumer configuration and check if the AckWait duration is appropriate for the expected processing time. It can also verify that MaxAckPending is set to a reasonable limit and that the FilterSubject is correctly specified. This allows developers to catch configuration errors early in the development process, before they are deployed to production.

import json

def check_consumer_config(config: dict) -> list[str]:
  """
  Uses an LLM to check for common configuration mistakes.
  """
  prompt = f"""
  You are a NATS JetStream expert. Review the following consumer configuration
  and identify any mistakes that could violate the at-least-once delivery guarantee.
  
  Configuration:
  {json.dumps(config, indent=2)}
  
  Common mistakes to check for:
  1. AckWait too low relative to typical processing times.
  2. MaxAckPending unbounded or too high for memory constraints.
  3. FilterSubject too broad or incorrect for the intended routing.
  4. ReplayPolicy set to 'instant' without considering consumer lag.
  5. InactiveThreshold too low, risking premature consumer deletion.
  
  Return a list of issues found with explanations.
  """
  # Call LLM API here
  # return llm_response
  pass

This method complements traditional monitoring by providing a layer of semantic analysis that is not possible with simple metric collection. It allows developers to ensure that their configurations are not only syntactically correct but also logically sound in the context of JetStream’s delivery guarantees.

Diagram

Conclusion and Best Practices

NATS JetStream’s at-least-once delivery guarantee is a powerful feature, but it is conditional on correct configuration. Developers must be aware of the common configuration mistakes that can silently violate these guarantees, leading to duplicate message processing, data loss, or redelivery storms [2]. Traditional monitoring tools like the Prometheus NATS exporter are insufficient for detecting these issues, as they only expose server-level throughput metrics [2].

To prevent these failures, developers should adopt a multi-layered approach to configuration management:

  1. Understand the Guarantees: Recognize that at-least-once delivery is conditional and relies on correct configuration [1].
  2. Avoid Common Mistakes: Be aware of the five common configuration mistakes that can violate delivery guarantees [2].
  3. Enhance Observability: Use LLMs to complement traditional monitoring tools and detect configuration-induced failures [2].
  4. Adopt Best Practices: Implement a multi-layered approach to configuration management to ensure reliability.

By following these best practices, developers can build robust and reliable message delivery systems using NATS JetStream.

References

  1. No such thing as exactly-once delivery — blog.sequinstream.com (30 September 2024)
  2. Configuration-Induced Delivery Failures in NATS JetStream: Detection and Remediation — arxiv.org