apache/beam · error · RuntimeException
Standard logical type '%s' does not have a zero-argument con
Error message
Standard logical type '%s' does not have a zero-argument constructor.
What it means
For standard logical types without an argument, SchemaTranslation instantiates the class via its no-arg constructor; if none exists (NoSuchMethodException) it throws RuntimeException 'does not have a zero-argument constructor'.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaTranslation.java:450
} catch (IllegalAccessException e) {
throw new RuntimeException(
String.format(
"Standard logical type '%s' has an of('%s') method, but it is not accessible.",
urn, objectName),
e);
} catch (InvocationTargetException e) {
throw new RuntimeException(
String.format(
"Error instantiating logical type '%s' with of('%s') method.",
urn, objectName),
e);
}
} else {
// Logical type without argument. Construct from constructor without parameter
try {
return FieldType.logicalType(logicalTypeClass.getConstructor().newInstance());
} catch (NoSuchMethodException e) {
throw new RuntimeException(
String.format(
"Standard logical type '%s' does not have a zero-argument constructor.", urn),
e);
} catch (IllegalAccessException e) {
throw new RuntimeException(
String.format(
"Standard logical type '%s' has a zero-argument constructor, but it is not accessible.",
urn),
e);
} catch (ReflectiveOperationException e) {
throw new RuntimeException(
String.format(
"Error instantiating logical type '%s' with zero-argument constructor.", urn),
e);
}
}
}
// Special-case for DATETIME and DECIMAL which are logical types in portable representation,View on GitHub (pinned to 12126d8942)
Solutions
- Add a public no-arg constructor to the logical type class.
- Register the correct implementation class for the URN (one that has a default constructor).
- If the type actually needs an argument, encode it as an argumented logical type so of() is used instead.
- Catch the RuntimeException at decode and report a schema compatibility error.
Example fix
// before
class IdLogicalType { public IdLogicalType(int seed){...} }
// after
class IdLogicalType { public IdLogicalType(){} public IdLogicalType(int seed){...} } Defensive patterns
Strategy: validation
Validate before calling
try { logicalTypeClass.getConstructor(); return true; }
catch (NoSuchMethodException e) { return false; } Prevention
- Always include a public no-arg constructor in argument-less logical types.
- Keep a default constructor when adding parameterized ones.
- Map URNs to classes that satisfy Beam's instantiation contract.
- Add round-trip proto tests for every custom logical type.
When it happens
Trigger: Decoding an argument-less logical type whose URN maps to a class with only parameterized constructors.
Common situations: Refactored logical type classes that lost their default constructor; classes with final fields requiring constructor args; Kotlin/Scala classes without explicit no-arg constructors.
Related errors
- Subclass of InferableFunction must override 'apply' method o
- error when invoking Coder factory method
- cannot register Coder : does not have an accessible method n
- cannot register Coder : method named 'of' with arguments of
- cannot register Coder : method named 'of' with arguments of
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/95370bec5c7f09eb.
Report an issue: GitHub.