apache/beam · error · IllegalArgumentException

Not an inferred logical type: ${rawType}

Error message

Not an inferred logical type: ${rawType}

What it means

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.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/ByteBuddyUtils.java:177

      return JAVA_UUID_LOGICAL_TYPE;
    }
    return null;
  }

  /** Maps a Java raw type to the static field name in {@link ByteBuddyUtils} that holds it. */
  private static String logicalTypeFieldName(Class<?> rawType) {
    if (LocalDate.class.equals(rawType)) {
      return "JAVA_LOCAL_DATE_LOGICAL_TYPE";
    } else if (LocalTime.class.equals(rawType)) {
      return "JAVA_LOCAL_TIME_LOGICAL_TYPE";
    } else if (LocalDateTime.class.equals(rawType)) {
      return "JAVA_LOCAL_DATE_TIME_LOGICAL_TYPE";
    } else if (java.time.Instant.class.equals(rawType)) {
      return "JAVA_INSTANT_LOGICAL_TYPE";
    } else if (UUID.class.equals(rawType)) {
      return "JAVA_UUID_LOGICAL_TYPE";
    }
    throw new IllegalArgumentException("Not an inferred logical type: " + rawType);
  }

  /** Stack manipulation that pushes the static {@link LogicalType} for the given Java type. */
  private static StackManipulation loadLogicalType(Class<?> rawType) {
    return FieldAccess.forField(
            BYTE_BUDDY_UTILS_TYPE
                .getDeclaredFields()
                .filter(ElementMatchers.named(logicalTypeFieldName(rawType)))
                .getOnly())
        .read();
  }

  /**
   * A naming strategy for ByteBuddy classes.
   *
   * <p>We always inject the generator classes in the same same package as the user's target class.
   * This way, if the class fields or methods are package private, our generated class can still
   * access them.

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use a supported type (LocalDate, LocalDateTime, Instant, UUID, etc.) as the base type of your inferred logical type.
  2. Register a custom LogicalType and ensure it is identified by its own identifier rather than relying on inferred mapping.
  3. Upgrade/patch Beam so logicalTypeFieldName covers your type, or avoid code paths that require ByteBuddy logical-type loading for it.

Example fix

// before
@DefaultSchema(AutoValueSchema.class) abstract class MyRow { abstract ZonedDateTime ts(); }
// after: use a supported type or custom LogicalType
@DefaultSchema(AutoValueSchema.class) abstract class MyRow { abstract Instant ts(); }
Defensive patterns

Strategy: validation

Validate before calling

static final Set<Class<?>> SUPPORTED = Set.of(java.time.LocalDate.class, java.time.LocalDateTime.class, java.time.Instant.class, java.util.UUID.class /* + others */);
if (!SUPPORTED.contains(rawType)) throw new IllegalArgumentException(rawType + " needs a custom LogicalType");

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5a6ee4fe1ff564dc. Report an issue: GitHub.