{"record":{"id":"6a72eb4db1345019","repo":"conductor-oss/conductor","slug":"error-evaluating-the-script-s","errorCode":null,"errorMessage":"Error evaluating the script `%s`","messagePattern":"Error evaluating the script `(.+?)`","errorType":"exception","errorClass":"TerminateWorkflowException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java","lineNumber":384,"sourceCode":"                throw new NonTransientException(\n                        String.format(\n                                \"Script not evaluated within %d seconds, interrupted.\",\n                                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();","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java#L366-L402","documentation":"Raised by handlePolyglotException when the ExecutionException's cause is a GraalVM PolyglotException but it has no SourceSection (getSourceLocation() returns null). This means the JS error could not be pinned to a line in the guest script — typically a host-interaction error, a polyglot-level abort, or an error synthesized without source metadata. It is rethrown as a TerminateWorkflowException, which fails the workflow.","triggerScenarios":"A script triggers a PolyglotException that carries no source location: host access denied, polyglot engine limit hit, guest code that throws a host exception object, or a GraalVM-internal error.","commonSituations":"Script tries to access a Java host object when host access is not enabled; GraalVM resource limit (e.g. memory) exceeded; guest throws an error constructed outside the parsed Source.","solutions":["Read pe.getMessage() to identify the underlying polyglot error class.","If it is a host-access error, remove the host call from the script (the engine disables load/print/console and host access by design).","If it is a resource limit, reduce the script's memory/CPU footprint or raise GraalVM resource limits.","For errors that should be retriable, wrap the script logic so it returns a sentinel instead of throwing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Reject scripts that attempt host access before eval.\nif (script.contains(\"Java.\") || script.contains(\"Polyglot.\")) {\n    throw new IllegalArgumentException(\"host access is disabled in the script engine\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object result = ScriptEvaluator.eval(script, input);\n} catch (TerminateWorkflowException e) {\n    // workflow will be terminated; record the polyglot message for diagnosis\n    LOGGER.error(\"Script terminated workflow: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Never rely on Java/host access from inline JS — the engine disables it.","Keep scripts to pure computation over the `$` input map.","Capture pe.getMessage() in logs to identify the polyglot error class."],"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"}