{"record":{"id":"a60e8b1eacc690fb","repo":"conductor-oss/conductor","slug":"error-evaluating-the-script-s-at-line-d","errorCode":null,"errorMessage":"Error evaluating the script `%s` at line %d","messagePattern":"Error evaluating the script `(.+?)` at line (.+?)","errorType":"exception","errorClass":"TerminateWorkflowException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java","lineNumber":387,"sourceCode":"                                maxExecutionTimeSeconds.getSeconds()));\n            } catch (ExecutionException ee) {\n                handlePolyglotException(ee);\n                return null;\n            } catch (InterruptedException ie) {\n                Thread.currentThread().interrupt();\n                throw new NonTransientException(\"Script execution interrupted: \" + ie.getMessage());\n            }\n        }\n    }\n\n    private static void handlePolyglotException(ExecutionException ee) {\n        if (ee.getCause() instanceof PolyglotException pe) {\n            SourceSection sourceSection = pe.getSourceLocation();\n            if (sourceSection == null) {\n                throw new TerminateWorkflowException(\n                        \"Error evaluating the script `\" + pe.getMessage() + \"`\");\n            } else {\n                throw new TerminateWorkflowException(\n                        \"Error evaluating the script `\"\n                                + pe.getMessage()\n                                + \"` at line \"\n                                + sourceSection.getStartLine());\n            }\n        }\n        throw new TerminateWorkflowException(\"Error evaluating the script \" + ee.getMessage());\n    }\n\n    private static Object getObject(Value value) {\n        if (value.isNull()) return null;\n        if (value.isBoolean()) return value.asBoolean();\n        if (value.isString()) return value.asString();\n        if (value.isNumber()) {\n            if (value.fitsInInt()) return value.asInt();\n            if (value.fitsInLong()) return value.asLong();\n            if (value.fitsInDouble()) return value.asDouble();\n        }","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java#L369-L405","documentation":"Raised by handlePolyglotException when a PolyglotException has a non-null SourceSection. This is the normal case for a guest-code runtime/syntax error: GraalVM can report the offending line. The message, with line number, is wrapped in a TerminateWorkflowException and terminates the workflow.","triggerScenarios":"A JavaScript expression throws a guest-level error that GraalVM attributes to a source location: TypeError, ReferenceError, SyntaxError, RangeError, or an explicit `throw` inside the script.","commonSituations":"Script references an undefined variable (e.g. typo in a `$.*` path), calls a non-function, indexes into null, or has a syntax error in a workflow's inline JS task.","solutions":["Use the reported line number to jump to the failing expression in the script.","Validate the script in a local GraalJS/Node REPL with the same input before deploying.","Add input guards (optional chaining, typeof checks) so missing fields do not throw.","For expression tasks, prefer simple `$.` accessors over imperative logic."],"exampleFix":"// before\n$.user.address.city  // throws if address is null\n\n// after\n($.user.address && $.user.address.city) || 'unknown'","handlingStrategy":"try-catch","validationCode":"// Pre-validate JS parses with a throwaway GraalVM Source before deployment.\ntry {\n    Source source = Source.create(\"js\", script);\n    // optionally eval against {} to surface runtime ReferenceErrors early\n} catch (org.graalvm.polyglot.PolyglotException pe) {\n    throw new IllegalArgumentException(\"Invalid script at line \" + pe.getSourceLocation().getStartLine(), pe);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object result = ScriptEvaluator.eval(script, input);\n} catch (TerminateWorkflowException e) {\n    LOGGER.error(\"Script error: {}\", e.getMessage()); // contains line number\n    throw e;\n}","preventionTips":["Test inline JS expressions against representative input before deploying.","Use optional chaining / null guards for `$.*` accesses.","Use the line number in the message to jump straight to the failing expression.","Prefer simple accessors over imperative logic in expression tasks."],"tags":["conductor","graalvm","javascript","script-evaluation","polyglot","terminate-workflow"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}