{"record":{"id":"5a6ee4fe1ff564dc","repo":"apache/beam","slug":"not-an-inferred-logical-type-rawtype","errorCode":null,"errorMessage":"Not an inferred logical type: ${rawType}","messagePattern":"Not an inferred logical type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/ByteBuddyUtils.java","lineNumber":177,"sourceCode":"      return JAVA_UUID_LOGICAL_TYPE;\n    }\n    return null;\n  }\n\n  /** Maps a Java raw type to the static field name in {@link ByteBuddyUtils} that holds it. */\n  private static String logicalTypeFieldName(Class<?> rawType) {\n    if (LocalDate.class.equals(rawType)) {\n      return \"JAVA_LOCAL_DATE_LOGICAL_TYPE\";\n    } else if (LocalTime.class.equals(rawType)) {\n      return \"JAVA_LOCAL_TIME_LOGICAL_TYPE\";\n    } else if (LocalDateTime.class.equals(rawType)) {\n      return \"JAVA_LOCAL_DATE_TIME_LOGICAL_TYPE\";\n    } else if (java.time.Instant.class.equals(rawType)) {\n      return \"JAVA_INSTANT_LOGICAL_TYPE\";\n    } else if (UUID.class.equals(rawType)) {\n      return \"JAVA_UUID_LOGICAL_TYPE\";\n    }\n    throw new IllegalArgumentException(\"Not an inferred logical type: \" + rawType);\n  }\n\n  /** Stack manipulation that pushes the static {@link LogicalType} for the given Java type. */\n  private static StackManipulation loadLogicalType(Class<?> rawType) {\n    return FieldAccess.forField(\n            BYTE_BUDDY_UTILS_TYPE\n                .getDeclaredFields()\n                .filter(ElementMatchers.named(logicalTypeFieldName(rawType)))\n                .getOnly())\n        .read();\n  }\n\n  /**\n   * A naming strategy for ByteBuddy classes.\n   *\n   * <p>We always inject the generator classes in the same same package as the user's target class.\n   * This way, if the class fields or methods are package private, our generated class can still\n   * access them.","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/ByteBuddyUtils.java#L159-L195","documentation":"ByteBuddyUtils.logicalTypeFieldName maps a fixed set of Java types (LocalDate, LocalDateTime, Instant, UUID, etc.) to their inferred logical type constants. If the raw type passed to loadLogicalType is not one of the supported inferred types, the method throws IllegalArgumentException. This is an internal dispatch — the caller should only pass types that were declared as inferred logical types.","triggerScenarios":"Schema inference infers a LogicalType for a Java type that is not one of the hardcoded java.time/UUID types supported by ByteBuddyUtils (e.g. a custom LogicalType, or a newer JDK date type added to inference but not to this switch).","commonSituations":"Using a custom LogicalType implementation whose base Java type isn't in the supported list; JDK upgrade introduces a new java.time type inferred by StaticSchemaInference but unmapped here; Beam version where inference and ByteBuddy mapping are out of sync.","solutions":["Use a supported type (LocalDate, LocalDateTime, Instant, UUID, etc.) as the base type of your inferred logical type.","Register a custom LogicalType and ensure it is identified by its own identifier rather than relying on inferred mapping.","Upgrade/patch Beam so logicalTypeFieldName covers your type, or avoid code paths that require ByteBuddy logical-type loading for it."],"exampleFix":"// before\n@DefaultSchema(AutoValueSchema.class) abstract class MyRow { abstract ZonedDateTime ts(); }\n// after: use a supported type or custom LogicalType\n@DefaultSchema(AutoValueSchema.class) abstract class MyRow { abstract Instant ts(); }","handlingStrategy":"validation","validationCode":"static final Set<Class<?>> SUPPORTED = Set.of(java.time.LocalDate.class, java.time.LocalDateTime.class, java.time.Instant.class, java.util.UUID.class /* + others */);\nif (!SUPPORTED.contains(rawType)) throw new IllegalArgumentException(rawType + \" needs a custom LogicalType\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict inferred logical types to the supported JDK types list.","Register custom LogicalTypes explicitly rather than relying on inference.","Pin a Beam version whose inference and ByteBuddy mappings match."],"tags":["java","schema","logical-type","bytebuddy"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}