pentaho/pentaho-kettle · error · KettleStepException

Unable to create value type

Error message

Unable to create value type

What it means

In getFields the step builds each output ValueMeta via ValueMetaFactory.createValueMeta(name, pentahoType). If the configured pentahoType is not a valid/registered value type, KettlePluginException is thrown and re-wrapped as KettleStepException 'Unable to create value type'.

Solutions

  1. Open the Avro Input mappings and re-select a valid Pentaho type for the offending field
  2. Fix the field's pentahoType in the stored step metadata/XML
  3. Check the wrapped KettlePluginException message to identify the bad type value

Example fix

// before
field.setPentahoType(-1); // invalid type id
// after
field.setPentahoType(ValueMetaInterface.TYPE_STRING);
Defensive patterns

Strategy: try-catch

Validate before calling

for (AvroInputField f : fields) {
  int t = f.getPentahoType();
  if (t < ValueMetaInterface.TYPE_STRING || t > ValueMetaInterface.TYPE_TIMESTAMP) {
    throw new KettleStepException("Invalid Pentaho type " + t + " for field " + f.getPentahoFieldName());
  }
}

Try / catch

try {
  meta.getFields(bowl, rowMeta, origin, info, nextStep, space, repository, metaStore);
} catch (KettleStepException e) {
  logError("Bad value type in Avro field mapping: " + e.getCause(), e);
  setErrors(1);
}

Prevention

When it happens

Trigger: A field mapping whose Pentaho type id is invalid (e.g. loaded from corrupted metadata or set programmatically to an out-of-range type constant).

Common situations: Mappings edited in the step dialog with an unsupported type; metadata migrated across PDI versions where type ids changed; repository/XML content corrupted.

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/61d84730c47e8a81. Report an issue: GitHub.

Appendix: source

Thrown at plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInputMetaBase.java:430

        if ( info != null ) {
          boolean found = false;
          for ( int i = 0; i < info.length && !found; i++ ) {
            if ( info[i] != null ) {
              rowMeta.mergeRowMeta( info[i], origin );
              found = true;
            }
          }
        }
      }
      for ( int i = 0; i < inputFields.length; i++ ) {
        AvroInputField field = inputFields[ i ];
        String value = space.environmentSubstitute( field.getPentahoFieldName() );
        ValueMetaInterface v = ValueMetaFactory.createValueMeta( value, field.getPentahoType() );
        v.setOrigin( origin );
        rowMeta.addValueMeta( v );
      }
    } catch ( KettlePluginException e ) {
      throw new KettleStepException( "Unable to create value type", e );
    }
  }

  @Injection( name = "AVRO_FILENAME"  )
  @Deprecated
  public void setDataFileName( String fileName ) {
    setDataLocation( fileName, LocationDescriptor.FILE_NAME );
    setFormat( SourceFormat.AVRO_USE_SCHEMA.ordinal() );
  }

  @Injection( name = "DATABASE_STREAM_NAME"  )
  @Deprecated
  public void setDataFieldName( String fieldName ) {
    setDataLocation( fieldName, LocationDescriptor.FIELD_NAME );
    setFormat( SourceFormat.AVRO_USE_SCHEMA.ordinal() );
  }

  @Injection( name = "SCHEMA_FILENAME"  )

View on GitHub (pinned to f3058517a1)