pentaho/pentaho-kettle · error · RuntimeException

Unhandled metadata injection of attribute: " +…

Error message

Unhandled metadata injection of attribute: " + fieldAttr.toString() + " - " + fieldAttr.getDescription()

What it means

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.

Solutions

  1. Read fieldAttr.toString() in the message to identify the offending key.
  2. Correct the key constant in the injection producer (use the exact keys like FIELD_FORMAT, FIELD_TRIM_TYPE).
  3. Add an else-if branch mapping the new key if the attribute is legitimately new.
  4. Regenerate injection metadata from the same Pentaho version as the runtime.

Example fix

// before
fieldEntries.add(new StepInjectionMetaEntry("TRIM_TYPE", ...)); // wrong key
// after
fieldEntries.add(new StepInjectionMetaEntry("FIELD_TRIM_TYPE",
  ValueMetaString.getTrimTypeCode(trimType), "Trim type"));
Defensive patterns

Strategy: validation

Validate before calling

Set<String> fieldKeys = Set.of("FIELD_NAME","FIELD_TYPE","FIELD_FORMAT","FIELD_LENGTH","FIELD_PRECISION","FIELD_CURRENCY","FIELD_DECIMAL","FIELD_GROUP","FIELD_TRIM_TYPE");
for (StepInjectionMetaEntry fa : fieldEntries) {
  if (!fieldKeys.contains(fa.getKey())) throw new IllegalArgumentException("Unsupported field key: " + fa.getKey());
}

Try / catch

try { injector.injectStepMetadata(stepId, meta, entries); }
catch (RuntimeException e) {
  if (e.getMessage().contains("Unhandled metadata injection of attribute")) {
    log.error("Fix field attribute key: {}", e.getMessage());
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/fa1f72417d6dee1d. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInputMeta.java:896

                inputField.setName( attributeValue );
              } else if ( fieldAttr.getKey().equals( "FIELD_TYPE" ) ) {
                inputField.setType( ValueMetaFactory.getIdForValueMeta( attributeValue ) );
              } else if ( fieldAttr.getKey().equals( "FIELD_FORMAT" ) ) {
                inputField.setFormat( attributeValue );
              } else if ( fieldAttr.getKey().equals( "FIELD_LENGTH" ) ) {
                inputField.setLength( attributeValue == null ? -1 : Integer.parseInt( attributeValue ) );
              } else if ( fieldAttr.getKey().equals( "FIELD_PRECISION" ) ) {
                inputField.setPrecision( attributeValue == null ? -1 : Integer.parseInt( attributeValue ) );
              } else if ( fieldAttr.getKey().equals( "FIELD_CURRENCY" ) ) {
                inputField.setCurrencySymbol( attributeValue );
              } else if ( fieldAttr.getKey().equals( "FIELD_DECIMAL" ) ) {
                inputField.setDecimalSymbol( attributeValue );
              } else if ( fieldAttr.getKey().equals( "FIELD_GROUP" ) ) {
                inputField.setGroupSymbol( attributeValue );
              } else if ( fieldAttr.getKey().equals( "FIELD_TRIM_TYPE" ) ) {
                inputField.setTrimType( ValueMetaString.getTrimTypeByCode( attributeValue ) );
              } else {
                throw new RuntimeException( "Unhandled metadata injection of attribute: "
                  + fieldAttr.toString() + " - " + fieldAttr.getDescription() );
              }
            }

            inputFields[row] = inputField;
          }
        }
      }
    }
  }

  @Override
  public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException {
    return null;
  }

  /**
   * Describe the metadata attributes that can be injected into this step metadata object.

View on GitHub (pinned to f3058517a1)