{"record":{"id":"dc140a06169dc956","repo":"pentaho/pentaho-kettle","slug":"unknown-field-location-type","errorCode":null,"errorMessage":"Unknown field location type","messagePattern":"Unknown field location type","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInput.java","lineNumber":256,"sourceCode":"      }\n    }\n    data.input.setLookupFields( lookupFields );\n\n    if ( inputFileName != null ) {\n      data.input.setInputFile( inputFileName );\n      data.input.setInputStreamFieldName( null );\n    } else if ( meta.getDataLocationType() == AvroInputMetaBase.LocationDescriptor.FIELD_NAME ) {\n      data.input.setInputStreamFieldName( meta.getDataLocation() );\n      data.input.setUseFieldAsInputStream( true );\n      int fieldIndex = getInputRowMeta().indexOfValue( data.input.getInputStreamFieldName() );\n      if ( fieldIndex == -1 ) {\n        throw new KettleException(\n          \"Field '\" + data.input.getInputStreamFieldName() + \"' was not found in step's input fields\" );\n      }\n      data.input\n        .setInputStream( new ByteArrayInputStream( getInputRowMeta().getBinary( inputToStepRow, fieldIndex ) ) );\n    } else {\n      throw new KettleException( \"Unknown field location type\" );\n    }\n\n    data.input.setIncomingFields( inputToStepRow );\n    data.reader = data.input.createRecordReader( null );\n    data.rowIterator = data.reader.iterator();\n\n    return true;\n  }\n\n\n  public void checkForLegacyFieldNames( String schemaFileName, String avroFileName ) {\n    // This routine will detect any field names in the schema that use the \"_delimiter_\" hack introduced in 8.0, find\n    // the truncated avro field names in the field list and rename them to what the avro file actually has.\n    try {\n      if ( !data.input.isUseFieldAsInputStream() ) {\n        List<? extends IAvroInputField> rawAvroFields = AvroInput\n          .getLeafFields( getTransMeta().getBowl(), schemaFileName, avroFileName, this.getTransMeta() );\n        Map<String, String> hackedFieldNames = new HashMap<>();","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/avro-format/core/src/main/java/org/pentaho/di/trans/steps/avro/input/AvroInput.java#L238-L274","documentation":"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.","triggerScenarios":"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).","commonSituations":"Transformations saved with an older/newer plugin version whose enum members differ; programmatic StepMeta construction with a hand-set location type.","solutions":["Reopen and re-save the Avro Input step to reset the location type to a valid value","Set dataLocationType to null (file) or LocationDescriptor.FIELD_NAME","Upgrade/downgrade the avro-format plugin so the stored enum matches the installed version"],"exampleFix":"// before\nmeta.setDataLocationType(AvroInputMetaBase.LocationDescriptor.valueOf(\"SOME_REMOVED\"));\n// after\nmeta.setDataLocationType(AvroInputMetaBase.LocationDescriptor.FIELD_NAME);","handlingStrategy":"validation","validationCode":"Object ldt = meta.getDataLocationType();\nboolean ok = ldt == null || ldt == AvroInputMetaBase.LocationDescriptor.FIELD_NAME;\nif (!ok) throw new KettleException(\"Invalid data location type: \" + ldt);","typeGuard":"boolean isKnownLocationType(AvroInputMetaBase.LocationDescriptor t) {\n  return t == null || t == AvroInputMetaBase.LocationDescriptor.FIELD_NAME;\n}","tryCatchPattern":"try {\n  initializeSource(row);\n} catch (KettleException e) {\n  logError(\"Unknown location type - re-save the Avro Input step: \" + e.getMessage());\n  setErrors(1);\n}","preventionTips":["Use the step dialog, not hand-edited XML, to set location type","Keep the avro-format plugin version consistent across environments","After plugin upgrades, reopen and re-save transformations using Avro Input"],"tags":["pdi","avro","enum"],"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"}