{"record":{"id":"c5676df8d4d18fde","repo":"pentaho/pentaho-kettle","slug":"avroinput-error-invalidpath","errorCode":null,"errorMessage":"AvroInput.Error.InvalidPath","messagePattern":"AvroInput\\.Error\\.InvalidPath","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":642,"sourceCode":"   * @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 );\n    if ( fieldS == null && !ignoreMissing ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"AvroInput.Error.NonExistentField\", part ) );\n    }\n    Object field = record.get( part );\n","sourceCodeStart":624,"sourceCodeEnd":660,"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#L624-L660","documentation":"Kettle exception thrown by convertToKettleValue when a path part of an AvroInputField begins with '['. Array/index selectors are only valid when attached to the end of a named field part (e.g. 'myfield[0]'), not as a standalone leading token. The path syntax is invalid for record traversal.","triggerScenarios":"The configured path contains an array index segment placed before any field name — e.g. path 'myfield.[0]' or a path split producing a part starting with '[' — so after remove(0) the part charAt(0) is '['.","commonSituations":"Users hand-writing paths for Avro arrays and prefixing the index; pasting JSONPath-style syntax (root '$[0]') into the Avro Input path box; paths built by script with a stray leading bracket.","solutions":["Remove the standalone '[...]' segment; put the array index on the end of the field name instead, e.g. 'mylist[0]'.","Verify the path uses Avro Input syntax (dot-separated field names with trailing [n] indexes), not JSONPath.","Check for stray leading brackets from copy/paste or split characters like '.' producing empty/bracket-only parts.","Use the step's schema-discovery path preview to build the path instead of typing it."],"exampleFix":"// before\nField path: items.[0].sku\n// after\nField path: items[0].sku","handlingStrategy":"validation","validationCode":"// Reject standalone bracket segments before passing the path to the step\nif (java.util.Arrays.stream(path.split(\"\\\\.\")).anyMatch(p -> p.startsWith(\"[\"))) {\n  throw new IllegalArgumentException(\"Array index must follow a field name: use 'field[0]', not '.[0]'\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  runTransformation();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"InvalidPath\")) {\n    logError(\"Fix path syntax: indexes go on field names (items[0]), not as separate segments\", e);\n  }\n}","preventionTips":["Never paste JSONPath syntax ($) into Avro Input paths","Pattern-check paths with regex: ^[A-Za-z_][\\w]*(\\[\\d+\\])?(\\.[\\w]+(\\[\\d+\\])?)*$","Prefer the path preview UI over manual path authoring"],"tags":["avro","path-syntax","array-selector"],"backgroundTag":"invalid-argument-format","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"}