{"record":{"id":"1febcc7d37b41b57","repo":"pentaho/pentaho-kettle","slug":"scriptvaluesmod-log-couldnotcompilejavascript","errorCode":null,"errorMessage":"ScriptValuesMod.Log.CouldNotCompileJavascript","messagePattern":"ScriptValuesMod\\.Log\\.CouldNotCompileJavascript","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java","lineNumber":314,"sourceCode":"            startScript.exec( data.cx, 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 \" + es.toString());\n          throw new KettleValueException( BaseMessages.getString(\n            PKG, \"ScriptValuesMod.Log.ErrorProcessingStartScript\" ), es );\n\n        }\n        // Now Compile our Script\n        data.script = data.cx.compileString( strTransformScript, \"script\", 1, null );\n      } catch ( Exception e ) {\n        throw new KettleValueException( BaseMessages.getString(\n          PKG, \"ScriptValuesMod.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() );\n\n    // Keep an index...\n    int outputIndex = rowMeta.size();\n\n    // Keep track of the changed values...\n    //\n    final Map<Integer, Value> usedRowValues;\n\n    if ( meta.isCompatible() ) {\n      usedRowValues = new Hashtable<Integer, Value>();\n    } else {","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesMod.java#L296-L332","documentation":"Thrown when the main transform script (strTransformScript) cannot be compiled by the embedded Rhino JavaScript engine. addValues() calls data.cx.compileString(strTransformScript, \"script\", 1, null) and wraps any compilation Exception in a KettleValueException with this message. This is a parse/syntax-time failure, not a runtime script error.","triggerScenarios":"compileString() throws a Rhino EvaluatorException (syntax error) while compiling the main script text entered in the Modified Java Script Value step, during addValues() from processRow.","commonSituations":"JavaScript syntax errors (missing braces/semicolons), ES6+ syntax unsupported by old Rhino (let, const, arrow functions, template literals), stray non-ASCII characters pasted from editors, or Java-style code pasted into the JS editor.","solutions":["Read the 'Caused by' EvaluatorException for the exact line/column of the syntax error","Fix the syntax error in the script editor of the step","Replace ES6+ constructs with ES5 equivalents compatible with the bundled Rhino version","Check for invisible/non-ASCII characters and retype the problematic line","Validate the script externally in a plain JS parser before pasting it back"],"exampleFix":"// before: ES6 syntax fails to compile in Rhino\nconst sum = (a, b) => a + b;\n// after: ES5-compatible\nvar sum = function( a, b ) { return a + b; };","handlingStrategy":"validation","validationCode":"// Check for common ES6 tokens unsupported by old Rhino before compiling\nfunction isRhinoSafe(src) {\n  return !/\\b(let|const|=>|`|\\.\\.\\.)\\b?/.test(src);\n}","typeGuard":null,"tryCatchPattern":"try {\n  runTransformation();\n} catch ( KettleValueException e ) {\n  if ( e.getCause() != null && e.getCause().getClass().getSimpleName().contains( \"Evaluator\" ) ) {\n    logError( \"Syntax error in transform script: \" + e.getCause().getMessage() );\n  }\n  throw e;\n}","preventionTips":["Write scripts in ES5 (var, function expressions) for old Rhino compatibility","Use the step's built-in script check/syntax verification before saving","Avoid copy-pasting code with smart quotes or invisible Unicode characters"],"tags":["javascript","rhino","syntax-error","compilation"],"backgroundTag":"invalid-argument-format","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"}