{"record":{"id":"b84f6bff7ca87be6","repo":"pentaho/pentaho-kettle","slug":"unhandled-metadata-injection-of-attribute-attr-tostring-attr","errorCode":null,"errorMessage":"Unhandled metadata injection of attribute: \" + attr.toString() + \" - \" + attr.getDescription()","messagePattern":"Unhandled metadata injection of attribute: \" \\+ attr\\.toString\\(\\) \\+ \" - \" \\+ attr\\.getDescription\\(\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInputMeta.java","lineNumber":857,"sourceCode":"          delimiter = (String) entry.getValue();\n        } else if ( attr.getKey().equals( \"ENCLOSURE\" ) ) {\n          enclosure = (String) entry.getValue();\n        } else if ( attr.getKey().equals( \"BUFFERSIZE\" ) ) {\n          bufferSize = (String) entry.getValue();\n        } else if ( attr.getKey().equals( \"LAZY_CONVERSION\" ) ) {\n          lazyConversionActive = (Boolean) entry.getValue();\n        } else if ( attr.getKey().equals( \"PARALLEL\" ) ) {\n          runningInParallel = (Boolean) entry.getValue();\n        } else if ( attr.getKey().equals( \"NEWLINE_POSSIBLE\" ) ) {\n          newlinePossibleInFields = (Boolean) entry.getValue();\n        } else if ( attr.getKey().equals( \"ADD_FILENAME_RESULT\" ) ) {\n          isaddresult = (Boolean) entry.getValue();\n        } else if ( attr.getKey().equals( \"FORMAT\" ) ) {\n          fileFormat = (String) entry.getValue();\n        } else if ( attr.getKey().equals( \"ENCODING\" ) ) {\n          encoding = (String) entry.getValue();\n        } else {\n          throw new RuntimeException( \"Unhandled metadata injection of attribute: \"\n            + attr.toString() + \" - \" + attr.getDescription() );\n        }\n      } else {\n        if ( attr.getKey().equals( \"FIELDS\" ) ) {\n          // This entry contains a list of lists...\n          // Each list contains a single CSV input field definition (one line in the dialog)\n          //\n          List<StepInjectionMetaEntry> inputFieldEntries = entry.getDetails();\n          inputFields = new TextFileInputField[inputFieldEntries.size()];\n          for ( int row = 0; row < inputFieldEntries.size(); row++ ) {\n            StepInjectionMetaEntry inputFieldEntry = inputFieldEntries.get( row );\n            TextFileInputField inputField = new TextFileInputField();\n\n            List<StepInjectionMetaEntry> fieldAttributes = inputFieldEntry.getDetails();\n            for ( int i = 0; i < fieldAttributes.size(); i++ ) {\n              StepInjectionMetaEntry fieldAttribute = fieldAttributes.get( i );\n              KettleAttributeInterface fieldAttr = findAttribute( fieldAttribute.getKey() );\n","sourceCodeStart":839,"sourceCodeEnd":875,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInputMeta.java#L839-L875","documentation":"During CsvInputMeta metadata injection, the constructor walks all top-level StepInjectionMetaEntry attributes and throws a RuntimeException if it encounters an attribute key it does not handle. This indicates the injection metadata set is out of sync with the supported keys (e.g. a new Pentaho version added a key this code doesn't map).","triggerScenarios":"Programmatic metadata injection into a CSV Input step (StepMetaInjector.injectStepMetadata) where the entry list contains a key other than the recognized ones (e.g. FORMAT, ENCODING, FIELDS), such as a newly introduced attribute key or a typo in the injected key.","commonSituations":"Injecting metadata generated by a different Pentaho/plugin version; custom injection code using a wrong key string; version upgrade adding NEW keys (e.g. additional flags) that the injection consumer doesn't map.","solutions":["Read attr.toString()/getDescription() in the message to find the unhandled key.","Add a handler branch for that key in the injection constructor, or remove it from the injected entry list.","Align the producing and consuming Pentaho versions so injection metadata matches supported keys.","As a stopgap, filter out known-irrelevant entries before injecting."],"exampleFix":"// before: injecting an unsupported key\nentries.add(new StepInjectionMetaEntry(\"NEW_KEY\", \"value\", \"New attribute\"));\n// after: use a supported key\nentries.add(new StepInjectionMetaEntry(\"ENCODING\", \"UTF-8\", \"The file encoding\"));","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"ENCLOSURE\",\"BUFFER_SIZE\",\"FILENAME\",\"ROW_NUM_FIELD\",\"FORMAT\",\"ENCODING\",\"FIELDS\",\"IS_ADD_RESULT\");\nfor (StepInjectionMetaEntry e : entries) {\n  if (!supported.contains(e.getKey())) throw new IllegalArgumentException(\"Unsupported key: \" + e.getKey());\n}","typeGuard":null,"tryCatchPattern":"try { injector.injectStepMetadata(stepId, meta, entries); }\ncatch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Unhandled metadata injection of attribute\")) {\n    log.error(\"Bad injection key: {}\", e.getMessage());\n  }\n}","preventionTips":["Generate injection entries from the same Pentaho version as the runtime","Use the documented key constants, not literal strings","Diff injection metadata across version upgrades and add handlers for new keys"],"tags":["kettle","metadata-injection","unsupported-key"],"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"}