pentaho/pentaho-kettle · error · KettleException
AvroInput.Error.MalformedPathArray
AvroInput.Error.MalformedPathArray
Error message
AvroInput.Error.MalformedPathArray
What it means
The array-walking branch of convertToKettleValue ran out of path parts when it reached an ARRAY node: the field path terminated at the array without an index selector. The reader cannot pick an element and throws this KettleException.
Solutions
- Append an index selector: '$.tags[0]'.
- Use the '[*]' expansion to emit one row per element: '$.tags[*]'.
- If a scalar was intended, correct the path to a scalar leaf in the schema.
Example fix
// before $.tags // after $.tags[0]
Defensive patterns
Strategy: validation
Validate before calling
// A path that reaches an ARRAY node must continue with [n] or [*]
if (fieldSchema.getType() == Schema.Type.ARRAY
&& !path.matches(".*\\[(\\d+|\\*)\\]$")) {
throw new IllegalArgumentException("Array path needs an index or [*]: " + path);
} Type guard
boolean arrayPathIndexed(String path, Schema fieldSchema) {
return fieldSchema.getType() != Schema.Type.ARRAY
|| (path != null && path.matches(".*\\[(\\d+|\\*)\\].*$"));
} Try / catch
try {
Object v = reader.convertToKettleValue(...);
} catch (KettleException e) {
if (e.getMessage().contains("MalformedPathArray")) {
// append [index] or switch to [*] expansion
} else throw e;
} Prevention
- Never end a field path at an array container
- Append '[n]' for a specific element or '[*]' for expansion
- Re-validate paths whenever the schema changes a field to an array
When it happens
Trigger: A field path ends exactly at an array node (e.g. '$.tags' where tags is an array) with no '[n]' or '[*]' following, and no expansion handler is in play.
Common situations: Forgetting the index after an array name; schema changed a scalar field into an array; copy-pasting a path that stopped at the container.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- AvroInput.Error.MalformedPathArray2
- AvroInput.Error.MalformedPathMap
- AvroInput.Error.MalformedPathMap2
- AvroInput.Error.MutipleDifferentExpansions
- AvroInput.Error.PathContainsMultipleExpansions
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/38e045d9df318f3e.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroNestedReader.java:534
/**
* Processes an array at this point in the path.
*
* @param array the array to process
* @param s the current schema at this point in the path
* @param ignoreMissing true if null is to be returned for user fields that don't appear in the schema
* @return the field value or null for out-of-bounds array indexes, non-existent map keys or unsupported avro types.
* @throws KettleException if a problem occurs
*/
public Object convertToKettleValue(AvroInputField avroInputField, GenericData.Array array, Schema s,
Schema defaultSchema, boolean ignoreMissing )
throws KettleException {
if ( array == null ) {
return null;
}
if ( avroInputField.getTempParts().size() == 0 ) {
throw new KettleException( BaseMessages.getString( PKG, "AvroInput.Error.MalformedPathArray" ) );
}
String part = avroInputField.getTempParts().remove( 0 );
if ( !( part.charAt( 0 ) == '[' ) ) {
throw new KettleException( BaseMessages.getString( PKG, "AvroInput.Error.MalformedPathArray2", part ) );
}
String index = part.substring( 1, part.indexOf( ']' ) );
int arrayI = 0;
try {
arrayI = Integer.parseInt( index.trim() );
} catch ( NumberFormatException e ) {
throw new KettleException( BaseMessages.getString( PKG, "AvroInput.Error.UnableToParseArrayIndex", index ) );
}
if ( part.indexOf( ']' ) < part.length() - 1 ) {
// more dimensions to the array
part = part.substring( part.indexOf( ']' ) + 1, part.length() );View on GitHub (pinned to f3058517a1)