pentaho/pentaho-kettle · error · KettleException

Unknown field location type

Error message

Unknown field location type

What it means

initializeSource dispatches on meta.getDataLocationType(): null/FIELD_NAME are handled explicitly, and any other unrecognized LocationDescriptor value falls into the else branch, which throws this KettleException.

Solutions

  1. Reopen and re-save the Avro Input step to reset the location type to a valid value
  2. Set dataLocationType to null (file) or LocationDescriptor.FIELD_NAME
  3. Upgrade/downgrade the avro-format plugin so the stored enum matches the installed version

Example fix

// before
meta.setDataLocationType(AvroInputMetaBase.LocationDescriptor.valueOf("SOME_REMOVED"));
// after
meta.setDataLocationType(AvroInputMetaBase.LocationDescriptor.FIELD_NAME);
Defensive patterns

Strategy: validation

Validate before calling

Object ldt = meta.getDataLocationType();
boolean ok = ldt == null || ldt == AvroInputMetaBase.LocationDescriptor.FIELD_NAME;
if (!ok) throw new KettleException("Invalid data location type: " + ldt);

Type guard

boolean isKnownLocationType(AvroInputMetaBase.LocationDescriptor t) {
  return t == null || t == AvroInputMetaBase.LocationDescriptor.FIELD_NAME;
}

Try / catch

try {
  initializeSource(row);
} catch (KettleException e) {
  logError("Unknown location type - re-save the Avro Input step: " + e.getMessage());
  setErrors(1);
}

Prevention

When it happens

Trigger: Setting meta.dataLocationType to a value outside the known LocationDescriptor set (e.g. stale enum constant after a plugin version change, or invalid value loaded from XML/repository).

Common situations: Transformations saved with an older/newer plugin version whose enum members differ; programmatic StepMeta construction with a hand-set location type.

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

Appendix: source

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

      }
    }
    data.input.setLookupFields( lookupFields );

    if ( inputFileName != null ) {
      data.input.setInputFile( inputFileName );
      data.input.setInputStreamFieldName( null );
    } else if ( meta.getDataLocationType() == AvroInputMetaBase.LocationDescriptor.FIELD_NAME ) {
      data.input.setInputStreamFieldName( meta.getDataLocation() );
      data.input.setUseFieldAsInputStream( true );
      int fieldIndex = getInputRowMeta().indexOfValue( data.input.getInputStreamFieldName() );
      if ( fieldIndex == -1 ) {
        throw new KettleException(
          "Field '" + data.input.getInputStreamFieldName() + "' was not found in step's input fields" );
      }
      data.input
        .setInputStream( new ByteArrayInputStream( getInputRowMeta().getBinary( inputToStepRow, fieldIndex ) ) );
    } else {
      throw new KettleException( "Unknown field location type" );
    }

    data.input.setIncomingFields( inputToStepRow );
    data.reader = data.input.createRecordReader( null );
    data.rowIterator = data.reader.iterator();

    return true;
  }


  public void checkForLegacyFieldNames( String schemaFileName, String avroFileName ) {
    // This routine will detect any field names in the schema that use the "_delimiter_" hack introduced in 8.0, find
    // the truncated avro field names in the field list and rename them to what the avro file actually has.
    try {
      if ( !data.input.isUseFieldAsInputStream() ) {
        List<? extends IAvroInputField> rawAvroFields = AvroInput
          .getLeafFields( getTransMeta().getBowl(), schemaFileName, avroFileName, this.getTransMeta() );
        Map<String, String> hackedFieldNames = new HashMap<>();

View on GitHub (pinned to f3058517a1)