{"record":{"id":"16a41498f99d9c6b","repo":"apache/beam","slug":"could-not-decode-the-value-from-row","errorCode":null,"errorMessage":"Could not decode the value from Row ","messagePattern":"Could not decode the value from Row ","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java","lineNumber":369,"sourceCode":"              (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    }\n\n    return parameterValues.toArray();\n  }\n\n  @SuppressWarnings(\"argument\")","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java#L351-L387","documentation":"Fallback branch of getDecodedValueFromRow: if the expected type is not primitive/wrapper/String, not an array, not a List, and the supplied value is not a Row, there is no decoding strategy and it throws RuntimeException including the offending value.","triggerScenarios":"Constructor parameter expects a complex type (e.g. a schema class) but the Row cell contains a scalar, or vice versa the type dispatch falls through — e.g. byte[] vs List handling, or value null/Map types not covered by the if/else chain.","commonSituations":"Mismatched constructor schema field types vs Java parameter types; custom types that are neither schema-registered nor Row-encoded; SDKs encoding values in formats the Java expansion service does not understand.","solutions":["Align the constructor schema field types with the Java constructor parameter types so the right branch executes.","If the value should be a complex object, ensure it is sent as a Row and the class is schema-registered (see NoSuchSchema error).","Extend decode handling (or convert the payload) for types like Map/bytes if genuinely needed.","Catch RuntimeException at parameterValue/constructor level and reject the expansion request with a clear message."],"exampleFix":"// before: scalar supplied for schema-typed parameter\nRow.ofSchema(schema, Arrays.asList(\"just-a-string\")) // param is MyConfig\n// after: supply a Row for the nested type\nRow.ofSchema(schema, Arrays.asList(Row.withSchema(configSchema).addValue(\"n\").build()))","handlingStrategy":"validation","validationCode":"// pre-check that each Row value kind matches the declared field type\nSchema.Field.Type ft = schema.getField(i).getType(); assert (ft.getTypeName().isPrimitiveType()) == isScalar(rowValue(i));","typeGuard":null,"tryCatchPattern":"try { decodeValue(...); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Could not decode the value from Row\")) { /* reject payload with type guidance */ } throw e; }","preventionTips":["Generate constructor schemas from the actual Java signatures","Encode complex parameters as Rows of schema-registered classes","Reject mismatched payloads at the requesting SDK before expansion","Cover every parameter type in integration tests"],"tags":["java","row-decoding","unsupported-type","beam"],"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"}