{"record":{"id":"8fe4b44188634f32","repo":"conductor-oss/conductor","slug":"error-evaluating-the-script-s-8fe4b4","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":394,"sourceCode":"            }\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        }\n        if (value.hasArrayElements()) {\n            List<Object> items = new ArrayList<>();\n            for (int i = 0; i < value.getArraySize(); i++) {\n                items.add(getObject(value.getArrayElement(i)));\n            }\n            return items;\n        }","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java#L376-L412","documentation":"The fallback branch of handlePolyglotException: the ExecutionException's cause is NOT a PolyglotException (some other Throwable escaped the guest eval). The raw ee.getMessage() is wrapped in a TerminateWorkflowException. This is the catch-all for unexpected, non-polyglot failures during script evaluation.","triggerScenarios":"A non-polyglot Throwable propagates from Context.eval: OutOfMemoryError, an IllegalStateException from a closed/misconfigured Context, a GraalVM engine failure, or a host-side runtime error not represented as PolyglotException.","commonSituations":"JVM heap exhaustion while evaluating a large script; GraalVM engine misconfiguration; classpath issues with the Truffle runtime producing a non-polyglot error.","solutions":["Inspect ee.getMessage() / the full stack trace in server logs — this is rarely a script bug.","If OutOfMemoryError: reduce script working set or increase JVM heap.","Verify the GraalVM/Truffle runtime is correctly on the classpath (check the startup log line `GraalVM polyglot engine: implementation=...`).","File an issue if the cause is an engine-level bug; capture the full ExecutionException cause chain."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Object result = ScriptEvaluator.eval(script, input);\n} catch (TerminateWorkflowException e) {\n    // non-polyglot cause; capture full server stack trace for diagnosis\n    LOGGER.error(\"Unexpected script eval failure: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Monitor JVM heap — OutOfMemoryError surfaces here as a non-polyglot cause.","Confirm the Truffle/GraalVM runtime is on the classpath (check the startup implementation log line).","Capture the full ExecutionException cause chain in logs, not just the message."],"tags":["conductor","graalvm","javascript","script-evaluation","polyglot","terminate-workflow","unexpected"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}