{"record":{"id":"c9e2396bd9edfdf0","repo":"pentaho/pentaho-kettle","slug":"entry-to-update-with-following-key-could-not-be-found","errorCode":null,"errorMessage":"Entry to update with following key could not be found: ","messagePattern":"Entry to update with following key could not be found: ","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/update/Update.java","lineNumber":120,"sourceCode":"       */\n      if ( !meta.isErrorIgnored() ) {\n        if ( getStepMeta().isDoingErrorHandling() ) {\n          outputRow = null;\n          if ( data.stringErrorKeyNotFound == null ) {\n            data.stringErrorKeyNotFound =\n              BaseMessages.getString( PKG, \"Update.Exception.KeyCouldNotFound\" )\n                + data.lookupParameterRowMeta.getString( lookupRow );\n            data.stringFieldnames = \"\";\n            for ( int i = 0; i < data.lookupParameterRowMeta.size(); i++ ) {\n              if ( i > 0 ) {\n                data.stringFieldnames += \", \";\n              }\n              data.stringFieldnames += data.lookupParameterRowMeta.getValueMeta( i ).getName();\n            }\n          }\n          putError( rowMeta, row, 1L, data.stringErrorKeyNotFound, data.stringFieldnames, \"UPD001\" );\n        } else {\n          throw new KettleDatabaseException( BaseMessages.getString( PKG, \"Update.Exception.KeyCouldNotFound\" )\n            + data.lookupParameterRowMeta.getString( lookupRow ) );\n        }\n      } else {\n        if ( log.isDetailed() ) {\n          logDetailed( BaseMessages.getString( PKG, \"Update.Log.KeyCouldNotFound\" )\n            + data.lookupParameterRowMeta.getString( lookupRow ) );\n        }\n        if ( !Utils.isEmpty( meta.getIgnoreFlagField() ) ) { // set flag field!\n\n          outputRow[rowMeta.size()] = Boolean.FALSE;\n        }\n      }\n    } else {\n      if ( !meta.isSkipLookup() ) {\n        if ( log.isRowLevel() ) {\n          logRowlevel( BaseMessages.getString( PKG, \"Update.Log.FoundRow\" )\n            + data.lookupReturnRowMeta.getString( add ) );\n        }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/update/Update.java#L102-L138","documentation":"Thrown by the Update step's lookupValues when a lookup row is not found in the target table and the step is configured to error (not insert/skip). It is a KettleDatabaseException whose message includes the stringified lookup parameter row, identifying the key values that were absent.","triggerScenarios":"During transformation execution, the prepared lookup SELECT returns no rows for the incoming stream row's key values while 'error on key not found' behavior is selected (the else-branch after putError).","commonSituations":"Running an update where the target row was deleted between steps; mismatched key field types (e.g. string '1' vs numeric 1) so lookups silently miss; feeding rows for keys that were never inserted.","solutions":["Check the step's 'Lookup key not found' handling setting and choose insert/skip/ignore instead of error if missing keys are expected","Verify key stream and lookup field names and data types match the target table columns exactly","Pre-validate that key values exist in the target table before updating (e.g. a lookup/table input step)","Inspect the lookup row values in the message to find which key values are missing and fix upstream data"],"exampleFix":"// before: step configured to throw on missing key\nthrow new KettleDatabaseException(...KeyCouldNotFound + data.lookupParameterRowMeta.getString(lookupRow));\n// after (step dialog): set 'Error on lookup key not found' = false, or route the error via putError/hop to an insert path","handlingStrategy":"validation","validationCode":"// Pre-check key existence in target table before update flow\n// Or in a UDJC/Script step:\nif (row exist check via lookup step fails) { route row to insert path or putError(); }","typeGuard":null,"tryCatchPattern":"try { updateStepResult } catch (KettleDatabaseException e) { if (e.getMessage().contains(\"KeyCouldNotFound\")) { /* route row to insert path */ } else { throw e; } }","preventionTips":["Configure 'lookup key not found' as insert/skip rather than error when missing keys are expected","Match key field data types exactly with target columns","Use an error handling hop to capture UPD001 errors instead of failing the transformation"],"tags":["database","lookup-miss","transformation"],"backgroundTag":"record-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"}