{"record":{"id":"0f475b9847f8ce2c","repo":"pentaho/pentaho-kettle","slug":"tableexists-log-errorinstep","errorCode":null,"errorMessage":"TableExists.Log.ErrorInStep","messagePattern":"TableExists\\.Log\\.ErrorInStep","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExists.java","lineNumber":108,"sourceCode":"      // Check if table exists on the specified connection\n      tablexists = data.db.checkTableExists( data.realSchemaname, tablename );\n\n      Object[] outputRowData = RowDataUtil.addValueData( r, getInputRowMeta().size(), tablexists );\n\n      // add new values to the row.\n      putRow( data.outputRowMeta, outputRowData ); // copy row to output rowset(s);\n\n      if ( log.isRowLevel() ) {\n        logRowlevel( BaseMessages.getString( PKG, \"TableExists.LineNumber\", getLinesRead()\n          + \" : \" + getInputRowMeta().getString( r ) ) );\n      }\n    } catch ( KettleException e ) {\n      if ( getStepMeta().isDoingErrorHandling() ) {\n        sendToErrorRow = true;\n        errorMessage = e.toString();\n      } else {\n        logError( BaseMessages.getString( PKG, \"TableExists.ErrorInStepRunning\" + \" : \" + e.getMessage() ) );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"TableExists.Log.ErrorInStep\" ), e );\n      }\n      if ( sendToErrorRow ) {\n        // Simply add this row to the error row\n        putError( getInputRowMeta(), r, 1, errorMessage, meta.getResultFieldName(), \"TableExistsO01\" );\n      }\n    }\n\n    return true;\n  }\n\n  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {\n    meta = (TableExistsMeta) smi;\n    data = (TableExistsData) sdi;\n\n    if ( super.init( smi, sdi ) ) {\n      if ( Utils.isEmpty( meta.getResultFieldName() ) ) {\n        logError( BaseMessages.getString( PKG, \"TableExists.Error.ResultFieldMissing\" ) );\n        return false;","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/tableexists/TableExists.java#L90-L126","documentation":"TableExists.processRow's catch-all: when a KettleException occurs and the step has NO error handling defined, it logs 'Error in step' and rethrows as KettleStepException, failing the transformation. If error handling IS enabled, the failing row is routed to the error stream instead and this throw does not happen.","triggerScenarios":"Any KettleException during step processing (missing field, DB failure) while the step is not connected to an error hop; the original exception is chained as the cause.","commonSituations":"Transformations run in production without error handling attached; database connectivity failures during the table-existence check; the underlying cause being errors 2332/2333 above.","solutions":["Read the chained cause (e) in the log to identify the real failure","Right-click the step and define error handling to route bad rows instead of aborting the transformation","Fix the root cause: field mapping or database connectivity"],"exampleFix":"// before: step aborts transformation\nstep -> next\n// after: enable error handling\nstep (right-click) -> Define Error Handling -> target error step","handlingStrategy":"try-catch","validationCode":"// enable error handling so bad rows are routed, not fatal\nif (!stepMeta.isDoingErrorHandling()) {\n  StepErrorMeta em = new StepErrorMeta(transMeta, stepMeta);\n  em.setTargetStep(errorStep);\n  stepMeta.setErrorMeta(em);\n}","typeGuard":null,"tryCatchPattern":"try { trans.waitUntilFinished(); if (trans.getErrors() > 0) { inspectStepLog(); } }\ncatch (KettleStepException e) { logError(\"TableExists failed: \" + e.getCause(), e); }","preventionTips":["Attach error handling hops to DB-touching steps in production transformations","Monitor transformation error counts and step logs after each run","Fix root causes (field mapping, DB connectivity) surfaced in the chained exception"],"tags":["kettle","step-execution","error-handling"],"backgroundTag":"invalid-state-transition","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"}