{"record":{"id":"7bf76293931379b6","repo":"pentaho/pentaho-kettle","slug":"script-log-errorprocessingstartscript","errorCode":"Script.Log.ErrorProcessingStartScript","errorMessage":"Script.Log.ErrorProcessingStartScript","messagePattern":"Script\\.Log\\.ErrorProcessingStartScript","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java","lineNumber":267,"sourceCode":"        }\n\n        try {\n          // Checking for StartScript\n          if ( strStartScript != null && strStartScript.length() > 0 ) {\n            CompiledScript startScript = ( (Compilable) data.cx ).compile( strStartScript );\n            startScript.eval( data.scope );\n            if ( log.isDetailed() ) {\n              logDetailed( ( \"Start Script found!\" ) );\n            }\n          } else {\n            if ( log.isDetailed() ) {\n              logDetailed( ( \"No starting Script found!\" ) );\n            }\n          }\n        } catch ( Exception es ) {\n          // System.out.println(\"Exception processing StartScript \" +\n          // es.toString());\n          throw new KettleValueException(\n            BaseMessages.getString( PKG, \"Script.Log.ErrorProcessingStartScript\" ), es );\n\n        }\n        // Now Compile our Script\n        // alternatively you could also support non compilable JSR223\n        // languages, see how we were doing before:\n        // http://github.com/rvalyi/jripple/blob/e6190fd89014a49b0faffae68c75762be124d899/\n        // src/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java\n\n        data.script = ( (Compilable) data.cx ).compile( strTransformScript );\n      } catch ( Exception e ) {\n        throw new KettleValueException( BaseMessages.getString( PKG, \"Script.Log.CouldNotCompileJavascript\" ), e );\n      }\n    }\n\n    // Filling the defined TranVars with the Values from the Row\n    //\n    Object[] outputRow = RowDataUtil.resizeArray( row, data.outputRowMeta.size() );","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java#L249-L285","documentation":"Thrown in Script.addValues when execution of the configured Start Script fails. The step runs an optional start script once before the main transform script; any Exception raised while processing it is wrapped in a KettleValueException with this message. The cause is in the wrapped exception (es).","triggerScenarios":"addValues (called from processRow) finding a non-empty Start Script (strStartScript) and evaluating it; the eval throws any Exception (syntax error, runtime error, missing function, disallowed operation).","commonSituations":"Syntax errors in the Start Script; calling functions not defined at start time; scripts copied from a Rhino-based step that use unsupported constructs under the JSR-223 engine; defining things the main script expects but with errors in the start script itself.","solutions":["Open the Start Script tab and fix the JavaScript syntax/runtime error reported in the wrapped cause.","Temporarily clear the Start Script to confirm the failure originates there.","Move start-script logic into the main script guarded by an if(first) block as an equivalent alternative.","Validate the script in the step's Test script button before running the transformation."],"exampleFix":"// before (Start Script)\nvar x = ;\n// after\nvar x = 0;","handlingStrategy":"try-catch","validationCode":"// smoke-test the start script before the run\nString js = meta.getStartScript();\nif (js != null && js.length() > 0) {\n  // evaluate with the step's 'Test script' button or a JS parser\n  new javax.script.ScriptEngineManager().getEngineByName(\"ECMAScript\").eval(js);\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch (KettleValueException e) {\n  if (e.getMessage().contains(\"ErrorProcessingStartScript\")) {\n    logError(\"Start script failed: \" + e.getCause().getMessage());\n  } else { throw e; }\n}","preventionTips":["Validate the Start Script with the Test script button before running.","Keep start-script logic minimal and syntax-simple.","Prefer if(first) blocks in the main script over a separate start script.","Beware engine differences (Rhino vs JSR-223 Nashorn) when copying scripts."],"tags":["kettle","javascript","start-script","script-error"],"backgroundTag":"invalid-argument-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"}