{"record":{"id":"dcf27822a152973b","repo":"apache/beam","slug":"invalid-startoffset-entry-expected-format-is-key-value","errorCode":null,"errorMessage":"Invalid startOffset entry: \"\". Expected format is \"key=value\".","messagePattern":"Invalid startOffset entry: \"\"\\. Expected format is \"key=value\"\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumTransformRegistrar.java","lineNumber":142,"sourceCode":"\n      DebeziumIO.Read<String> readTransform =\n          DebeziumIO.readAsJson().withConnectorConfiguration(connectorConfiguration);\n\n      if (configuration.maxNumberOfRecords != null) {\n        readTransform =\n            readTransform.withMaxNumberOfRecords(configuration.maxNumberOfRecords.intValue());\n      }\n\n      if (configuration.maxTimeToRun != null) {\n        readTransform = readTransform.withMaxTimeToRun(configuration.maxTimeToRun);\n      }\n\n      if (configuration.startOffset != null) {\n        Map<String, Object> startOffsetMap = new HashMap<>();\n        for (String property : configuration.startOffset) {\n          String[] parts = property.split(\"=\", 2);\n          if (parts.length != 2) {\n            throw new IllegalArgumentException(\n                \"Invalid startOffset entry: \\\"\"\n                    + property\n                    + \"\\\". Expected format is \\\"key=value\\\".\");\n          }\n          String key = parts[0];\n          String value = parts[1];\n          try {\n            startOffsetMap.put(key, Long.parseLong(value));\n          } catch (NumberFormatException e) {\n            startOffsetMap.put(key, value);\n          }\n        }\n        readTransform = readTransform.withStartOffset(startOffsetMap);\n      }\n\n      if (configuration.offsetStoragePath != null) {\n        readTransform =\n            readTransform.withOffsetRetainer(","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumTransformRegistrar.java#L124-L160","documentation":"DebeziumIO's external transform registrar validates each --startOffset command-line entry as a key=value pair. split(\"=\", 2) must yield exactly two parts; an empty or '='-less string fails. This guards the map built from startOffset entries.","triggerScenarios":"Passing an empty string or a string with no '=' at all (split(\"=\", 2) yields length 1) in configuration.startOffset when building the external Debezium transform.","commonSituations":"Trailing empty element from a shell expansion (e.g. an environment variable like OFFSETS=\"k1=v1,$EXTRA\" where EXTRA is empty expanded to --startOffset twice), hand-typed CLI flags with a missing '='.","solutions":["Inspect the --startOffset arguments and remove/fix any entry without '='.","Quote entries in shell scripts so empty expansions are skipped: use arrays and conditional appends.","Validate entries in the pipeline launcher before invoking buildExternal."],"exampleFix":"// before\n--startOffset=\"\" --startOffset=partition=0\n// after\n--startOffset=partition=0","handlingStrategy":"validation","validationCode":"for (String prop : startOffsetArgs) {\n  if (prop == null || !prop.contains(\"=\")) {\n    throw new IllegalArgumentException(\"startOffset entries must be key=value, got: \" + prop);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  DebeziumIO.buildExternal(...);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Invalid startOffset entry\")) {\n    // sanitize args: drop entries without '='\n  }\n}","preventionTips":["Build --startOffset arrays programmatically and filter empty/null elements before expansion","Never interpolate unset env vars into startOffset args","Unit-test the arg assembly for your launch script"],"tags":["java","configuration","argument-parsing","apache-beam"],"backgroundTag":"invalid-argument-format","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"}