{"record":{"id":"095592db1bb88205","repo":"apache/beam","slug":"could-not-determine-the-row-function-for-class","errorCode":null,"errorMessage":"Could not determine the row function for class ","messagePattern":"Could not determine the row function for class ","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java","lineNumber":364,"sourceCode":"      List<Object> originalList = (List) valueFromRow;\n      List<Object> decodedList = new ArrayList<>();\n      for (Object obj : originalList) {\n        if (genericType instanceof ParameterizedType) {\n          Class<?> elementType =\n              (Class<?>) ((ParameterizedType) genericType).getActualTypeArguments()[0];\n          decodedList.add(getDecodedValueFromRow(elementType, obj, null));\n        } else {\n          throw new RuntimeException(\"Could not determine the generic type of the list\");\n        }\n      }\n      return decodedList;\n    } else if (valueFromRow instanceof Row) {\n      Row row = (Row) valueFromRow;\n      SerializableFunction<Row, ?> fromRowFunc;\n      try {\n        fromRowFunc = SCHEMA_REGISTRY.getFromRowFunction(type);\n      } catch (NoSuchSchemaException e) {\n        throw new IllegalArgumentException(\n            \"Could not determine the row function for class \" + type, e);\n      }\n      return fromRowFunc.apply(row);\n    }\n    throw new RuntimeException(\"Could not decode the value from Row \" + valueFromRow);\n  }\n\n  @SuppressWarnings(\"argument\")\n  private Object[] getParameterValues(\n      java.lang.reflect.Parameter[] parameters, Row constrtuctorRow, Type[] genericTypes) {\n    ArrayList<Object> parameterValues = new ArrayList<>();\n    for (int i = 0; i < parameters.length; ++i) {\n      java.lang.reflect.Parameter parameter = parameters[i];\n      Class<?> parameterClass = parameter.getType();\n      Object parameterValue =\n          getDecodedValueFromRow(parameterClass, constrtuctorRow.getValue(i), genericTypes[i]);\n      parameterValues.add(parameterValue);\n    }","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java#L346-L382","documentation":"For a constructor parameter whose value arrives as a Beam Row, the decoder looks up a fromRow function in the SchemaRegistry for the target class. If the class has no registered schema (NoSuchSchemaException), it throws IllegalArgumentException naming the class.","triggerScenarios":"A constructor parameter is a POJO/complex type, the payload provides a Row for it, but the class was never registered with a schema (no @DefaultSchema annotation and no SchemaRegistry.register call).","commonSituations":"Custom PTransform constructor taking a user options/config class that lacks @DefaultSchema; class registered under a different ClassLoader in the expansion service; refactored class name no longer matching the registered schema.","solutions":["Annotate the class with @DefaultSchema(JavaBeanSchema.class) or another SchemaProvider.","Explicitly register it: SchemaRegistry.getDefault().getSchemaProvider(MyClass.class) or register(Class, SchemaProvider).","Make sure the same ClassLoader in the expansion service loads the annotated class.","Catch IllegalArgumentException and surface 'register a schema for class X' guidance to the pipeline author."],"exampleFix":"// before\npublic class MyOptions { private String name; ... }\n// after\n@DefaultSchema(JavaBeanSchema.class)\npublic class MyOptions { private String name; ... }","handlingStrategy":"validation","validationCode":"try { SchemaRegistry.getDefault().getSchema(MyClass.class); } catch (NoSuchSchemaException e) { throw new IllegalStateException(\"Register a schema for MyClass (@DefaultSchema)\"); }","typeGuard":null,"tryCatchPattern":"try { parameterValues(...); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Could not determine the row function\")) { /* prompt schema registration */ } throw e; }","preventionTips":["Annotate every constructor parameter type with @DefaultSchema","Register schemas explicitly in the expansion service main","Ensure one ClassLoader loads annotated classes","Test schema lookup for each parameter type at service startup"],"tags":["java","schema-registry","beam","missing-schema"],"backgroundTag":"schema-validation-failed","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"}