{"record":{"id":"82f1b13bf7c9f563","repo":"pentaho/pentaho-kettle","slug":"calculator-errorinsteprunning","errorCode":"Calculator.ErrorInStepRunning","errorMessage":"Calculator.ErrorInStepRunning","messagePattern":"Calculator\\.ErrorInStepRunning","errorType":"error_code","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java","lineNumber":175,"sourceCode":"      putRow( data.getOutputRowMeta(), row ); // copy row to possible alternate rowset(s).\n\n      if ( log.isRowLevel() ) {\n        logRowlevel( \"Wrote row #\" + getLinesWritten() + \" : \" + getInputRowMeta().getString( r ) );\n      }\n      if ( checkFeedback( getLinesRead() ) ) {\n        if ( log.isBasic() ) {\n          logBasic( BaseMessages.getString( PKG, \"Calculator.Log.Linenr\", \"\" + getLinesRead() ) );\n        }\n      }\n    } catch ( KettleFileNotFoundException e ) {\n      if ( meta.isFailIfNoFile() ) {\n        logError( BaseMessages.getString( PKG, \"Calculator.Log.NoFile\" ) + \" : \" + e.getFilepath() );\n        setErrors( getErrors() + 1 );\n        return false;\n      }\n    } catch ( KettleException e ) {\n      logError( BaseMessages.getString( PKG, \"Calculator.ErrorInStepRunning\" + \" : \" + e.getMessage() ) );\n      throw new KettleStepException( BaseMessages.getString( PKG, \"Calculator.ErrorInStepRunning\" ), e );\n    }\n    return true;\n  }\n\n  /**\n   * @param inputRowMeta\n   *          the input row metadata\n   * @param r\n   *          the input row (data)\n   * @return A row including the calculations, excluding the temporary values\n   * @throws KettleValueException\n   *           in case there is a calculation error.\n   */\n  private Object[] calcFields( RowMetaInterface inputRowMeta, Object[] r ) throws KettleValueException,\n          KettleFileNotFoundException {\n    // First copy the input data to the new result...\n    Object[] calcData = RowDataUtil.resizeArray( r, data.getCalcRowMeta().size() );\n","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java#L157-L193","documentation":"processRow wraps the per-row calculation logic in a catch for KettleException; when any calculation fails at runtime it logs the message and rethrows a KettleStepException with localized text Calculator.ErrorInStepRunning and the original exception as cause. It is a generic wrapper: the real cause is in the chained exception (e.g. division by zero, type conversion failure inside calcFields).","triggerScenarios":"Any KettleException thrown by calcFields while processing a row (invalid data conversions, arithmetic errors, value type problems) inside processRow's try block.","commonSituations":"Non-numeric data in a field used by a numeric calculation; null handling errors; downstream issues surfacing as calculation failures on specific rows.","solutions":["Inspect the cause (e) chain in the stack trace / log for the underlying per-row error","Fix the offending data (e.g. clean non-numeric values with a Data Validator/If-Null step before the Calculator)","Set the step's error handling to route bad rows instead of failing the transformation"],"exampleFix":"// before\nCalculator -> numeric calc on \"amount\" (contains 'N/A' strings)\n// after\nData Validator / Replace in string (remove non-numeric) -> Calculator","handlingStrategy":"try-catch","validationCode":"// sanitize inputs before the Calculator:\n// use 'If field value is null' and 'Data Validator' steps to remove bad rows/values","typeGuard":null,"tryCatchPattern":"try {\n  // run step\n} catch (KettleStepException e) {\n  logError(\"Calculator failed: \" + e.getMessage(), e); // inspect getCause() for the real per-row error\n  setErrors(getErrors() + 1);\n}","preventionTips":["Clean and type-cast data before the Calculator (null handling, Data Validator)","Configure step error handling to divert bad rows to an alternate stream","Always read the cause chain — this message is only a wrapper"],"tags":["kettle","pdi","calculator","runtime","wrapped-exception"],"backgroundTag":"sql-query-failed","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"}