{"record":{"id":"e108da7e11f45c32","repo":"pentaho/pentaho-kettle","slug":"avroinput-error-malformedpathrecord","errorCode":null,"errorMessage":"AvroInput.Error.MalformedPathRecord","messagePattern":"AvroInput\\.Error\\.MalformedPathRecord","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java","lineNumber":637,"sourceCode":"  /**\n   * Processes a record at this point in the path.\n   *\n   * @param record        the record to process\n   * @param s             the current schema at this point in the path\n   * @param ignoreMissing true if null is to be returned for user fields that don't appear in the schema\n   * @return the field value or null for out-of-bounds array indexes, non-existent map keys or unsupported avro types.\n   * @throws KettleException if a problem occurs\n   */\n  public Object convertToKettleValue(AvroInputField avroInputField, GenericData.Record record, Schema s,\n                                     Schema defaultSchema, boolean ignoreMissing )\n    throws KettleException {\n\n    if ( record == null ) {\n      return null;\n    }\n\n    if ( avroInputField.getTempParts().size() == 0 ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"AvroInput.Error.MalformedPathRecord\" ) );\n    }\n\n    String part = avroInputField.getTempParts().remove( 0 );\n    if ( part.charAt( 0 ) == '[' ) {\n      throw new KettleException(\n        BaseMessages.getString( PKG, \"AvroInput.Error.InvalidPath\" ) + avroInputField.getTempParts() );\n    }\n\n    if ( part.indexOf( '[' ) > 0 ) {\n      String arrayPart = part.substring( part.indexOf( '[' ) );\n      part = part.substring( 0, part.indexOf( '[' ) );\n\n      // put the array section back into location zero\n      avroInputField.getTempParts().add( 0, arrayPart );\n    }\n\n    // part is a named field of the record\n    Schema.Field fieldS = s.getField( part );","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java#L619-L655","documentation":"Kettle exception thrown by AvroNestedReader.convertToKettleValue when the AvroInput field's path part list is exhausted while still trying to convert a record value. It means the configured read path did not correspond to the record structure being processed — no further path segment exists to navigate into the record. The path is malformed relative to the Avro record's schema.","triggerScenarios":"convertToKettleValue is called (directly or recursively from setKettleFields) with an AvroInputField whose tempParts list is empty after the value was resolved to a record — i.e. the path string was shorter than the actual nesting depth of the data, or the record was reached with no remaining path parts to select a field from.","commonSituations":"Users configure an Avro Input step path like 'myfield' when the data contains a nested record at that point requiring a further selector (e.g. 'myfield.innerField'); copy-pasting paths from a differently-versioned schema; paths pointing at a record without drilling into its fields.","solutions":["Extend the field's path so it fully traverses the nested record down to a primitive/leaf field (e.g. 'myrecord.fieldName').","Check the configured path against the actual Avro schema nesting; each record level needs one additional dot-separated part.","If the path was truncated by escaping issues, verify special characters (dots inside field names) are handled correctly.","Re-read the schema via the step's field discovery UI to regenerate the correct path."],"exampleFix":"// before\nField path: order                     // stops on a record\n// after\nField path: order.customer_id         // traverses into the record","handlingStrategy":"validation","validationCode":"// Before running the transformation, verify each field path resolves to a leaf in the schema\nif (!pathContainsLeafField(avroSchema, fieldPath)) {\n  throw new IllegalArgumentException(\"Path '\" + fieldPath + \"' does not reach a leaf field; extend it through the record\");\n}","typeGuard":null,"tryCatchPattern":"// Wrap conversion per field so one bad path doesn't kill the whole transformation\ntry {\n  value = reader.convertToKettleValue(record, schema, field);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"MalformedPathRecord\")) {\n    logError(\"Path for field '\" + field.getFieldName() + \"' stops at a record; extend the path\", e);\n  }\n}","preventionTips":["Always derive paths from the step's schema discovery instead of typing them by hand","Remember every record level requires one more dot-separated path part","Validate paths against the actual file's writer schema, not an assumed one"],"tags":["avro","path-malformed","kettle"],"backgroundTag":"schema-validation-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}