conductor-oss/conductor · error · TerminateWorkflowException

Error evaluating the script `%s`

Error message

Error evaluating the script `%s`

What it means

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.

Source

Thrown at core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java:384

                throw new NonTransientException(
                        String.format(
                                "Script not evaluated within %d seconds, interrupted.",
                                maxExecutionTimeSeconds.getSeconds()));
            } catch (ExecutionException ee) {
                handlePolyglotException(ee);
                return null;
            } catch (InterruptedException ie) {
                Thread.currentThread().interrupt();
                throw new NonTransientException("Script execution interrupted: " + ie.getMessage());
            }
        }
    }

    private static void handlePolyglotException(ExecutionException ee) {
        if (ee.getCause() instanceof PolyglotException pe) {
            SourceSection sourceSection = pe.getSourceLocation();
            if (sourceSection == null) {
                throw new TerminateWorkflowException(
                        "Error evaluating the script `" + pe.getMessage() + "`");
            } else {
                throw new TerminateWorkflowException(
                        "Error evaluating the script `"
                                + pe.getMessage()
                                + "` at line "
                                + sourceSection.getStartLine());
            }
        }
        throw new TerminateWorkflowException("Error evaluating the script " + ee.getMessage());
    }

    private static Object getObject(Value value) {
        if (value.isNull()) return null;
        if (value.isBoolean()) return value.asBoolean();
        if (value.isString()) return value.asString();
        if (value.isNumber()) {
            if (value.fitsInInt()) return value.asInt();

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Read pe.getMessage() to identify the underlying polyglot error class.
  2. 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).
  3. If it is a resource limit, reduce the script's memory/CPU footprint or raise GraalVM resource limits.
  4. For errors that should be retriable, wrap the script logic so it returns a sentinel instead of throwing.
Defensive patterns

Strategy: try-catch

Validate before calling

// Reject scripts that attempt host access before eval.
if (script.contains("Java.") || script.contains("Polyglot.")) {
    throw new IllegalArgumentException("host access is disabled in the script engine");
}

Try / catch

try {
    Object result = ScriptEvaluator.eval(script, input);
} catch (TerminateWorkflowException e) {
    // workflow will be terminated; record the polyglot message for diagnosis
    LOGGER.error("Script terminated workflow: {}", e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/6a72eb4db1345019. Report an issue: GitHub.