{"record":{"id":"9ebc4b32131e6acc","repo":"pentaho/pentaho-kettle","slug":"script-log-couldnotattachadditionalscripts","errorCode":"Script.Log.CouldNotAttachAdditionalScripts","errorMessage":"Script.Log.CouldNotAttachAdditionalScripts","messagePattern":"Script\\.Log\\.CouldNotAttachAdditionalScripts","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java","lineNumber":218,"sourceCode":"        //\n        data.scope.put( \"rowMeta\", rowMeta );\n\n        // Modification for Additional Script parsing\n        //\n        try {\n          if ( meta.getAddClasses() != null ) {\n            for ( int i = 0; i < meta.getAddClasses().length; i++ ) {\n              // TODO AKRETION ensure it works\n              data.scope.put( meta.getAddClasses()[ i ].getJSName(), meta.getAddClasses()[ i ].getAddObject() );\n              // Object jsOut =\n              // Context.javaToJS(meta.getAddClasses()[i].getAddObject(),\n              // data.scope);\n              // ScriptableObject.putProperty(data.scope,\n              // meta.getAddClasses()[i].getJSName(), jsOut);\n            }\n          }\n        } catch ( Exception e ) {\n          throw new KettleValueException( BaseMessages.getString(\n            PKG, \"Script.Log.CouldNotAttachAdditionalScripts\" ), e );\n        }\n\n        // Adding some default JavaScriptFunctions to the System\n        // TODO AKRETION not implemented yet\n        // try {\n        // Context.javaToJS(ScriptValuesAddedFunctions.class,\n        // data.scope);\n        // ((ScriptableObject)\n        // data.scope).defineFunctionProperties(ScriptValuesAddedFunctions.jsFunctionList,\n        // ScriptValuesAddedFunctions.class, ScriptableObject.DONTENUM);\n        // } catch (Exception ex) {\n        // // System.out.println(ex.toString());\n        // throw new KettleValueException(BaseMessages.getString(PKG, \"Script.Log.CouldNotAddDefaultFunctions\"), ex);\n        // }\n        // ;\n\n        // Adding some Constants to the JavaScript","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/Script.java#L200-L236","documentation":"Thrown in Script.addValues when the step fails while attaching additional script classes/objects (the AddClasses / additional scripts, e.g. Java classes exposed to the JavaScript scope) — any Exception during that setup is wrapped in a KettleValueException with this message. It occurs during per-row initialization of the JS scope, so it aborts the transformation run.","triggerScenarios":"addValues (called from processRow) reaching the additional-scripts attach block and encountering any Exception while binding the configured additional script/class objects to the JavaScript scope (the property-binding code shown commented in the source).","commonSituations":"Transformations using legacy 'Java classes'/additional script features not implemented in this modified Script step (the code around it is commented out with TODO AKRETION); corrupt or unsupported step metadata carried over from ScriptValuesMod; classpath issues loading the referenced classes.","solutions":["Remove any 'Java classes' / additional script entries from the step's config — this modified step does not support attaching them.","Recreate the step metadata fresh rather than importing old ScriptValuesMod transformation XML.","If classes are referenced, verify they exist on the classpath (libext/plugins) or drop the dependency.","Move needed logic into the main transform script instead of additional classes."],"exampleFix":"// before: step configured with a Java class entry in 'Add classes'\n// after: delete the class entry and inline the logic in the main script\n//   (the attach path is effectively unimplemented in this step)","handlingStrategy":"validation","validationCode":"// before running: reject metadata carrying unsupported additional classes\nif (meta.getAddClasses() != null && meta.getAddClasses().length > 0) {\n  throw new IllegalStateException(\n    \"Additional Java classes are not supported by this Script step; remove them.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch (KettleValueException e) {\n  if (e.getMessage().contains(\"CouldNotAttachAdditionalScripts\")) {\n    logError(\"Unsupported additional scripts/classes in step config\", e);\n  } else { throw e; }\n}","preventionTips":["Do not configure Java classes / additional scripts on this modified Script step.","Recreate step metadata instead of importing legacy ScriptValuesMod XML.","Inline shared logic into the main script or a User Defined Java Class step.","Keep required classes on the classpath if you must use class-based steps."],"tags":["kettle","javascript","script-scope","configuration"],"backgroundTag":"method-not-implemented","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"}