{"record":{"id":"50ea588ff4b300f2","repo":"pentaho/pentaho-kettle","slug":"avroinput-error-malformedpathmap2","errorCode":"AvroInput.Error.MalformedPathMap2","errorMessage":"AvroInput.Error.MalformedPathMap2","messagePattern":"AvroInput\\.Error\\.MalformedPathMap2","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":448,"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,\n                                      Map<Utf8, Object> map, Schema s, Schema defaultSchema, boolean ignoreMissing )\n    throws KettleException {\n\n    if ( map == null ) {\n      return null;\n    }\n\n    if ( avroInputField.getTempParts().size() == 0 ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"AvroInput.Error.MalformedPathMap\" ) );\n    }\n\n    String part = avroInputField.getTempParts().remove( 0 );\n    if ( !( part.charAt( 0 ) == '[' ) ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"AvroInput.Error.MalformedPathMap2\", part ) );\n    }\n\n    String key = part.substring( 1, part.indexOf( ']' ) );\n\n    if ( part.indexOf( ']' ) < part.length() - 1 ) {\n      // more dimensions to the array/map\n      part = part.substring( part.indexOf( ']' ) + 1, part.length() );\n      avroInputField.getTempParts().add( 0, part );\n    }\n\n    Object value = map.get( new Utf8( key ) );\n    if ( value == null ) {\n      return null;\n    }\n\n    Schema valueType = s.getValueType();\n\n    if ( valueType.getType() == Schema.Type.UNION ) {","sourceCodeStart":430,"sourceCodeEnd":466,"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#L430-L466","documentation":"The map-walking branch of convertToKettleValue popped the next path part and expects it to be a bracketed key selector like '[mykey]'. The part did not start with '[', so it is not a valid map key accessor; the reader throws this KettleException naming the offending part.","triggerScenarios":"A path segment following a map node is a plain name (dot notation) instead of a '[key]' bracket, e.g. '$.mymap.color' or '$.mymap.color' where the schema at that point is a MAP. The message includes the bad segment.","commonSituations":"Assuming Avro maps behave like records and using dot-notation keys; paths copied from JSON tooling that accept dot access for maps.","solutions":["Replace the dot-notation key with bracket notation: '$.mymap[color]'.","If the target is actually a RECORD, fix the path/schema so the reader uses the record branch (dot access works only for records).","Regenerate the schema and confirm node types; adjust the field path in the step definition accordingly."],"exampleFix":"// before\n$.mymap.color\n// after\n$.mymap[color]","handlingStrategy":"validation","validationCode":"// The segment after a map must be bracketed, not dotted\nString[] parts = path.split(\"\\\\.\");\nString last = parts[parts.length - 1];\nif (nodeIsMap(parentSchema) && !last.startsWith(\"[\")) {\n  throw new IllegalArgumentException(\"Map access must use [key] syntax: \" + last);\n}","typeGuard":"boolean isBracketed(String segment) {\n  return segment != null && segment.startsWith(\"[\") && segment.endsWith(\"]\");\n}","tryCatchPattern":"try {\n  Object v = reader.convertToKettleValue(...);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"MalformedPathMap2\")) {\n    // convert dot notation to bracket notation for that segment\n  } else throw e;\n}","preventionTips":["Use '[key]' for Avro maps, dot notation only for records","Never copy JSON dot-access paths directly into Avro Input paths","Test each path against a sample record before production runs"],"tags":["avro","path","malformed-path","pdi"],"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"}