{"record":{"id":"871206f26f124932","repo":"apache/beam","slug":"unknown-timestamp-bound-mode-mode","errorCode":null,"errorMessage":"Unknown timestamp bound mode: + mode","messagePattern":"Unknown timestamp bound mode: \\+ mode","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerTransformRegistrar.java","lineNumber":218,"sourceCode":"            }\n            if (timeUnit == null) {\n              throw new NullPointerException(\n                  \"Time unit cannot be null when MAX_STALENESS or EXACT_STALENESS mode is selected\");\n            }\n            return mode == MAX_STALENESS\n                ? TimestampBound.ofMaxStaleness(staleness, TimeUnit.valueOf(timeUnit))\n                : TimestampBound.ofExactStaleness(staleness, TimeUnit.valueOf(timeUnit));\n          case READ_TIMESTAMP:\n          case MIN_READ_TIMESTAMP:\n            if (readTimestamp == null) {\n              throw new NullPointerException(\n                  \"Timestamp cannot be null when READ_TIMESTAMP or MIN_READ_TIMESTAMP mode is selected\");\n            }\n            return mode == READ_TIMESTAMP\n                ? TimestampBound.ofReadTimestamp(Timestamp.parseTimestamp(readTimestamp))\n                : TimestampBound.ofMinReadTimestamp(Timestamp.parseTimestamp(readTimestamp));\n          default:\n            throw new IllegalArgumentException(\"Unknown timestamp bound mode: \" + mode);\n        }\n      }\n\n      public ReadOperation getReadOperation() {\n        if (sql != null && table != null) {\n          throw new IllegalStateException(\n              \"Query and table params are mutually exclusive. Set just one of them.\");\n        }\n        ReadOperation readOperation = ReadOperation.create();\n        if (sql != null) {\n          return readOperation.withQuery(sql);\n        }\n        if (Schema.builder().build().equals(schema)) {\n          throw new IllegalArgumentException(\"Schema can't be empty\");\n        }\n        if (table != null) {\n          return readOperation.withTable(table).withColumns(schema.getFieldNames());\n        }","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/SpannerTransformRegistrar.java#L200-L236","documentation":"getTimestampBound() switches over the configured timestamp bound mode and falls through to a default branch that throws IllegalArgumentException(\"Unknown timestamp bound mode: \" + mode) when the mode string/value does not match any known enum constant (STRONG, MAX_STALENESS, EXACT_STALENESS, READ_TIMESTAMP, MIN_READ_TIMESTAMP). It means the mode supplied to the Spanner read configuration is not recognized.","triggerScenarios":"Passing a mode string that is not a valid enum name — wrong casing (\"strong\"), misspelling (\"MAX_STALENSS\"), a numeric/ordinal value instead of a name, or an externally-supplied mode value outside the enum set.","commonSituations":"Pipeline spec JSON/YAML written by hand or generated by another tool using different mode vocabulary; version drift where a mode was renamed; languages/dialects that lowercase enum names in serialization.","solutions":["Use exactly one of: STRONG, MAX_STALENESS, EXACT_STALENESS, READ_TIMESTAMP, MIN_READ_TIMESTAMP (enum name, uppercase).","Validate the mode against TimestampBoundMode.valueOf(mode) in a try/catch before building.","If the value comes from config, log the raw value and compare against the enum's allowed values."],"exampleFix":"// before\n.withTimestampBoundMode(\"max_staleness\")\n// after\n.withTimestampBoundMode(\"MAX_STALENESS\")","handlingStrategy":"validation","validationCode":"try { TimestampBoundMode.valueOf(modeStr); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(\"mode must be one of STRONG, MAX_STALENESS, EXACT_STALENESS, READ_TIMESTAMP, MIN_READ_TIMESTAMP, got: \" + modeStr); }","typeGuard":null,"tryCatchPattern":"try { config.timestampBound(); } catch (IllegalArgumentException e) { log.error(\"Bad timestamp bound mode: {}\", e.getMessage()); throw new ConfigException(e); }","preventionTips":["Keep mode values as enum types end-to-end; only stringify at the config boundary.","Normalize casing (toUpperCase) before valueOf.","Document the exact enum names in your pipeline-spec schema."],"tags":["java","apache-beam","google-cloud-spanner","enum"],"backgroundTag":"invalid-enum-value","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"}