{"record":{"id":"ac4f5370ab5cb2f5","repo":"apache/beam","slug":"invalid-jmsmessageid-s-while-requiresdeduping-is-set-data","errorCode":null,"errorMessage":"Invalid JMSMessageID %s while requiresDeduping is set. Data loss possible.","messagePattern":"Invalid JMSMessageID (.+?) while requiresDeduping is set\\. Data loss possible\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java","lineNumber":821,"sourceCode":"            checkpointMarkPreparer.add(message);\n          }\n        }\n        if (message == null) {\n          currentMessage = null;\n          return false;\n        }\n\n        currentMessage = this.source.spec.getMessageMapper().mapMessage(message);\n        currentTimestamp = new Instant(message.getJMSTimestamp());\n\n        String messageID = message.getJMSMessageID();\n        if (messageID != null) {\n          if (this.source.spec.isRequiresDeduping()) {\n            // per JMS specification, message ID has prefix \"id:\". The runner use it to dedup\n            // message. Empty or non-exist message id (possible for optimization configuration set)\n            // will cause data loss.\n            if (messageID.length() <= 3) {\n              throw new RuntimeException(\n                  String.format(\n                      \"Invalid JMSMessageID %s while requiresDeduping is set. Data loss possible.\",\n                      messageID));\n            }\n          }\n          currentID = messageID.getBytes(StandardCharsets.UTF_8);\n        } else {\n          currentID = EMPTY;\n        }\n\n        return true;\n      } catch (Exception e) {\n        throw new IOException(e);\n      }\n    }\n\n    @Override\n    public T getCurrent() throws NoSuchElementException {","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/jms/src/main/java/org/apache/beam/sdk/io/jms/JmsIO.java#L803-L839","documentation":"When the JmsIO read source is configured with withRequiresDeduping(true), Beam relies on the JMSMessageID as the deduplication key; per the JMS spec message IDs start with \"ID:\". If the received message's ID is null-truncated to 3 chars or shorter, deduping would silently drop data, so the reader throws a RuntimeException warning that data loss is possible.","triggerScenarios":"Receiving a JMS message whose getJMSMessageID() returns null or a string of length <= 3 (e.g. \"\" or \"ID:\") while source.spec.isRequiresDeduping() is true.","commonSituations":"Producers that override/disable message IDs for performance (e.g. non-persistent messages with optimized ID generation), non-compliant broker implementations, or messages routed through bridges that strip IDs.","solutions":["Ensure producers generate valid JMSMessageIDs: disable any 'disableMessageID' optimization on MessageProducer/sender config.","If IDs are legitimately absent, remove withRequiresDeduping(true) from the read spec.","Verify the broker conforms to the JMS spec regarding ID generation (\"ID:\" prefix)."],"exampleFix":"// before (producer side)\nproducer.setDisableMessageID(true);\n// after\nproducer.setDisableMessageID(false); // or drop withRequiresDeduping() from the Beam source","handlingStrategy":"validation","validationCode":"// before enabling deduping, verify producers set message IDs\nString id = message.getJMSMessageID();\nboolean safeForDedup = id != null && id.length() > 3 && id.startsWith(\"ID:\");\nif (!safeForDedup) { /* don't call withRequiresDeduping(true) */ }","typeGuard":null,"tryCatchPattern":"try { reader.advance(); } catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Invalid JMSMessageID\")) {\n    // disable requiresDeduping or fix producer config\n  }\n}","preventionTips":["Never set producer.setDisableMessageID(true) when consuming with requiresDeduping.","Test with production broker settings that may strip or shorten message IDs."],"tags":["jms","deduplication","data-loss"],"backgroundTag":"empty-required-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}