{"record":{"id":"15b303a0a98f4555","repo":"pentaho/pentaho-kettle","slug":"error0001","errorCode":"ERROR0001","errorMessage":"DatabaseLookup.ERROR0001.FieldRequired5.Exception + keyFields[i] + DatabaseLookup.ERROR0001.FieldRequired6.Exception","messagePattern":"DatabaseLookup\\.ERROR0001\\.FieldRequired5\\.Exception \\+ keyFields\\[i\\] \\+ DatabaseLookup\\.ERROR0001\\.FieldRequired6\\.Exception","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java","lineNumber":241,"sourceCode":"\n  @VisibleForTesting\n  void determineFieldsTypesQueryingDb() throws KettleException {\n    final String[] keyFields = meta.getTableKeyField();\n    data.keytypes = new int[ keyFields.length ];\n\n    String schemaTable =\n      meta.getDatabaseMeta().getQuotedSchemaTableCombination(\n        environmentSubstitute( meta.getSchemaName() ), environmentSubstitute( meta.getTablename() ) );\n\n    RowMetaInterface fields = data.db.getTableFields( schemaTable );\n    if ( fields != null ) {\n      // Fill in the types...\n      for ( int i = 0; i < keyFields.length; i++ ) {\n        ValueMetaInterface key = fields.searchValueMeta( keyFields[ i ] );\n        if ( key != null ) {\n          data.keytypes[ i ] = key.getType();\n        } else {\n          throw new KettleStepException( BaseMessages.getString(\n            PKG, \"DatabaseLookup.ERROR0001.FieldRequired5.Exception\" )\n            + keyFields[ i ]\n            + BaseMessages.getString( PKG, \"DatabaseLookup.ERROR0001.FieldRequired6.Exception\" ) );\n        }\n      }\n\n      if ( shouldDatabaseReturnValueTypeBeUsed() ) {\n        useReturnValueTypeFromDatabase( fields );\n      }\n\n    } else {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"DatabaseLookup.ERROR0002.UnableToDetermineFieldsOfTable\" )\n        + schemaTable + \"]\" );\n    }\n  }\n\n  /*","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/databaselookup/DatabaseLookup.java#L223-L259","documentation":"DatabaseLookup.determineFieldsTypesQueryingDb() queries the lookup table metadata and, for each configured key field, looks it up in the resulting table field list via fields.searchValueMeta(keyFields[i]). If the key field is not a column of the lookup table, it throws KettleStepException 'Field required' (FieldRequired5/6) naming the missing key field.","triggerScenarios":"processRow() runs with a lookup that must determine key types from the database (no cached row) and a configured key field (keyFields[i]) does not exist in the schema.table being looked up.","commonSituations":"Typo in the lookup-table key column name; the lookup table was renamed or its schema changed after the step was configured; the transformation was moved to an environment where the table has different columns.","solutions":["Edit the Database Lookup step and set key fields that actually exist as columns in the lookup table","Refresh the step's table-field list after any table schema change","Qualify the table with the correct schema (schema.table) so the right table's columns are read","Re-run the step metadata lookup (preview) to validate field names before executing"],"exampleFix":"// before (step config)\nkeyField = \"custumer_id\";\n// after\nkeyField = \"customer_id\"; // must match a real column of the lookup table","handlingStrategy":"validation","validationCode":"// validate key fields exist in the lookup table before running the transformation\nDatabaseMeta dbMeta = meta.getDatabaseMeta();\nRowMetaInterface tableFields = db.getTableFields( meta.getSchemaTable() );\nfor ( String kf : meta.getKeyField() ) {\n  if ( tableFields == null || tableFields.searchValueMeta( kf ) == null ) {\n    throw new KettleException( \"Lookup key field not a table column: \" + kf );\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  result = step.lookup( row );\n} catch ( KettleStepException e ) {\n  if ( e.getMessage() != null && e.getMessage().contains( keyFieldName ) ) {\n    // refresh table metadata, fix mapping, retry\n  } else { throw e; }\n}","preventionTips":["Refresh the Database Lookup step dialog after any table DDL change","Use schema-qualified table names","Add transformation checks (Spoon 'Verify') which report missing field mappings","Preview the lookup step to validate configuration before full runs"],"tags":["kettle","database","field-mapping","lookup"],"backgroundTag":"resource-not-found","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"}