{"record":{"id":"fa1f72417d6dee1d","repo":"pentaho/pentaho-kettle","slug":"unhandled-metadata-injection-of-attribute-fieldattr-tostring","errorCode":null,"errorMessage":"Unhandled metadata injection of attribute: \" + fieldAttr.toString() + \" - \" + fieldAttr.getDescription()","messagePattern":"Unhandled metadata injection of attribute: \" \\+ fieldAttr\\.toString\\(\\) \\+ \" - \" \\+ fieldAttr\\.getDescription\\(\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInputMeta.java","lineNumber":896,"sourceCode":"                inputField.setName( attributeValue );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_TYPE\" ) ) {\n                inputField.setType( ValueMetaFactory.getIdForValueMeta( attributeValue ) );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_FORMAT\" ) ) {\n                inputField.setFormat( attributeValue );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_LENGTH\" ) ) {\n                inputField.setLength( attributeValue == null ? -1 : Integer.parseInt( attributeValue ) );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_PRECISION\" ) ) {\n                inputField.setPrecision( attributeValue == null ? -1 : Integer.parseInt( attributeValue ) );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_CURRENCY\" ) ) {\n                inputField.setCurrencySymbol( attributeValue );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_DECIMAL\" ) ) {\n                inputField.setDecimalSymbol( attributeValue );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_GROUP\" ) ) {\n                inputField.setGroupSymbol( attributeValue );\n              } else if ( fieldAttr.getKey().equals( \"FIELD_TRIM_TYPE\" ) ) {\n                inputField.setTrimType( ValueMetaString.getTrimTypeByCode( attributeValue ) );\n              } else {\n                throw new RuntimeException( \"Unhandled metadata injection of attribute: \"\n                  + fieldAttr.toString() + \" - \" + fieldAttr.getDescription() );\n              }\n            }\n\n            inputFields[row] = inputField;\n          }\n        }\n      }\n    }\n  }\n\n  @Override\n  public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException {\n    return null;\n  }\n\n  /**\n   * Describe the metadata attributes that can be injected into this step metadata object.","sourceCodeStart":878,"sourceCodeEnd":914,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInputMeta.java#L878-L914","documentation":"Within the FIELDS list handling of CsvInputMeta metadata injection, each per-field attribute (one row of the dialog) is mapped with an if/else chain; an unrecognized field attribute key throws a RuntimeException naming the key and its description. It means one of the injected field attributes is not supported by this version's mapping.","triggerScenarios":"Metadata injection of the FIELDS grid where a per-field entry key is misspelled or comes from a newer/older schema (e.g. injecting 'FIELD_DECIMAL' when the code expects 'FIELD_DECIMAL_SYMBOL'), so it falls through to the final else.","commonSituations":"Version skew between the code producing injection entries and the CSV Input meta consuming them; hand-written injection code with a wrong key constant; keys copied from another step's field definitions.","solutions":["Read fieldAttr.toString() in the message to identify the offending key.","Correct the key constant in the injection producer (use the exact keys like FIELD_FORMAT, FIELD_TRIM_TYPE).","Add an else-if branch mapping the new key if the attribute is legitimately new.","Regenerate injection metadata from the same Pentaho version as the runtime."],"exampleFix":"// before\nfieldEntries.add(new StepInjectionMetaEntry(\"TRIM_TYPE\", ...)); // wrong key\n// after\nfieldEntries.add(new StepInjectionMetaEntry(\"FIELD_TRIM_TYPE\",\n  ValueMetaString.getTrimTypeCode(trimType), \"Trim type\"));","handlingStrategy":"validation","validationCode":"Set<String> fieldKeys = Set.of(\"FIELD_NAME\",\"FIELD_TYPE\",\"FIELD_FORMAT\",\"FIELD_LENGTH\",\"FIELD_PRECISION\",\"FIELD_CURRENCY\",\"FIELD_DECIMAL\",\"FIELD_GROUP\",\"FIELD_TRIM_TYPE\");\nfor (StepInjectionMetaEntry fa : fieldEntries) {\n  if (!fieldKeys.contains(fa.getKey())) throw new IllegalArgumentException(\"Unsupported field key: \" + fa.getKey());\n}","typeGuard":null,"tryCatchPattern":"try { injector.injectStepMetadata(stepId, meta, entries); }\ncatch (RuntimeException e) {\n  if (e.getMessage().contains(\"Unhandled metadata injection of attribute\")) {\n    log.error(\"Fix field attribute key: {}\", e.getMessage());\n  }\n}","preventionTips":["Prefix field-grid keys with FIELD_ exactly as the meta expects","Copy key constants from CsvInputMeta source instead of retyping","Test injection on a sample transformation before production runs"],"tags":["kettle","metadata-injection","fields-grid"],"backgroundTag":"invalid-enum-value","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"}