{"record":{"id":"9e4280f08d387406","repo":"apache/beam","slug":"encountered-unrecognized-timezone-type-gettimezone","errorCode":null,"errorMessage":"Encountered unrecognized Timezone: ${type.getTimezone()}","messagePattern":"Encountered unrecognized Timezone: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/arrow/src/main/java/org/apache/beam/sdk/extensions/arrow/ArrowConversion.java","lineNumber":522,"sourceCode":"      public Optional<Function<Object, Object>> visit(ArrowType.Date type) {\n        throw new IllegalArgumentException(\"Type \\'\" + type.toString() + \"\\' not supported.\");\n      }\n\n      @Override\n      public Optional<Function<Object, Object>> visit(ArrowType.Time type) {\n        throw new IllegalArgumentException(\"Type \\'\" + type.toString() + \"\\' not supported.\");\n      }\n\n      @Override\n      public Optional<Function<Object, Object>> visit(ArrowType.Timestamp type) {\n        // Arrow timestamp semantics:\n        // - With timezone: epoch is always UTC, timezone is display metadata\n        // - Without timezone: epoch is in an unknown timezone (\"naive\" wall-clock time)\n        DateTimeZone tz;\n        try {\n          tz = DateTimeZone.forID(type.getTimezone());\n        } catch (Exception e) {\n          throw new IllegalArgumentException(\n              \"Encountered unrecognized Timezone: \" + type.getTimezone());\n        }\n\n        return Optional.of(\n            epoch -> {\n              switch (type.getUnit()) {\n                case MILLISECOND:\n                  return new DateTime((long) epoch, tz);\n                case MICROSECOND:\n                  return new DateTime(Math.floorDiv((long) epoch, 1000L), tz);\n                case NANOSECOND:\n                  long seconds = Math.floorDiv((long) epoch, 1_000_000_000L);\n                  long nanoAdjustment = Math.floorMod((long) epoch, 1_000_000_000L);\n                  return java.time.Instant.ofEpochSecond(seconds, nanoAdjustment);\n                default:\n                  throw new AssertionError(\"Encountered unrecognized TimeUnit: \" + type.getUnit());\n              }\n            });","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/arrow/src/main/java/org/apache/beam/sdk/extensions/arrow/ArrowConversion.java#L504-L540","documentation":"When converting Arrow timestamp columns, the library parses the timezone string via Joda's DateTimeZone.forID; an unrecognized/invalid timezone ID makes it throw IllegalArgumentException. Arrow timestamps carry a timezone string that must be a valid IANA identifier for the converter to build a correct instant.","triggerScenarios":"Arrow schema declares a Timestamp field whose getTimezone() is null for a tz-aware conversion path, a non-IANA string (e.g. 'UTC+2', 'GMT-05:00', or a typo like 'Amercia/New_York'), so DateTimeZone.forID fails.","commonSituations":"Data written by tools that store offset-style or custom timezone labels; null timezone on naive timestamps where the converter expects an ID; cross-version schema drift where the writer emitted an abbreviation like 'EST'.","solutions":["Normalize the Arrow timestamp timezone to a valid IANA ID (e.g. 'America/New_York', 'UTC') in the producer","Use Arrow timestamp without timezone (null) if wall-clock semantics are intended and the schema path supports it","Pre-parse/validate the timezone with DateTimeZone.forID before conversion and repair invalid IDs","Convert timestamps to epoch longs upstream and skip the tz-aware branch"],"exampleFix":"// before\nnew ArrowType.Timestamp(ArrowType.TimeUnit.MILLISECOND, \"UTC+2\") // throws\n// after\nnew ArrowType.Timestamp(ArrowType.TimeUnit.MILLISECOND, \"UTC\")","handlingStrategy":"validation","validationCode":"import org.joda.time.DateTimeZone;\nString tzId = timestampField.getType().getTimezone();\ntry {\n  DateTimeZone.forID(tzId);\n} catch (Exception e) {\n  throw new IllegalArgumentException(\"Arrow timestamp timezone not a valid IANA ID: \" + tzId);\n}","typeGuard":"boolean isValidIANATimezone(String id) {\n  try { org.joda.time.DateTimeZone.forID(id); return true; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  rows = ArrowConversion.rowsFromRecordBatch(schema, batches);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Encountered unrecognized Timezone\")) {\n    throw new ConfigException(\"Fix the Arrow timestamp timezone ID\", e);\n  }\n  throw e;\n}","preventionTips":["Always use IANA timezone IDs ('UTC', 'America/New_York'), never offsets or abbreviations","Validate timezone strings at ingestion boundaries","Standardize on null-timezone (naive) or 'UTC' Arrow timestamps across producers"],"tags":["java","apache-beam","arrow","timezone"],"backgroundTag":"invalid-config-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"}