{"record":{"id":"66ccd8c6ac3ce6a7","repo":"conductor-oss/conductor","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java","lineNumber":255,"sourceCode":"        return input;\n    }\n\n    /**\n     * Validates that the script is syntactically well formed WITHOUT executing it. Registration\n     * time validation must not evaluate expressions: the input bindings still hold unresolved\n     * {@code ${...}} placeholders, so any expression referencing a runtime-bound value would throw\n     * a ReferenceError and wrongly reject a valid definition (issue #1311).\n     *\n     * @param script Script whose syntax should be checked.\n     * @throws IllegalArgumentException if the script has a syntax error.\n     */\n    public static void validateScriptSyntax(String script) {\n        ensureInitialized();\n        try (Context context = createNewContext()) {\n            context.parse(getSource(script));\n        } catch (PolyglotException e) {\n            if (e.isSyntaxError()) {\n                throw new IllegalArgumentException(e.getMessage());\n            }\n            // Anything non-syntactic (e.g. resource limits) is not a validation failure\n            LOGGER.debug(\"Ignoring non-syntax error while validating script: {}\", e.getMessage());\n        }\n    }\n\n    /**\n     * Returns a cached compiled {@link Source} for the given script, creating it on first use.\n     * Bounded by {@link #sourceCacheMaxSize}; on overflow the cache is cleared (workflow scripts\n     * are typically a small, stable set, so the simplest strategy suffices).\n     */\n    private static Source getSource(String script) {\n        Source cached = SOURCE_CACHE.get(script);\n        if (cached != null) {\n            return cached;\n        }\n        if (SOURCE_CACHE.size() >= sourceCacheMaxSize) {\n            SOURCE_CACHE.clear();","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/core/events/ScriptEvaluator.java#L237-L273","documentation":"Thrown by ScriptEvaluator.validateScriptSyntax when the GraalVM PolyglotException raised by context.parse(source) is a syntax error. validateScriptSyntax only parses (does not execute) the script to check it is well-formed; a genuine JS syntax error is re-thrown as IllegalArgumentException whose message is the PolyglotException's own message (hence the '%s'). Non-syntax errors (e.g. resource-limit errors) are deliberately ignored.","triggerScenarios":"Registering or validating a JavaScript script (an event-handler condition, an inline task, or any evaluator='javascript' definition) that contains a syntax error — unbalanced braces, invalid token, unterminated string, reserved-word misuse, etc. The script is parsed at registration/validation time before any runtime binding exists.","commonSituations":"Authoring a JS expression in a workflow/event definition with a typo. Pasting a JS snippet that depends on template placeholders (${...}) that are valid at runtime but the snippet itself is malformed independent of them. A script that uses syntax not supported by the configured GraalVM/JS language version.","solutions":["Read the PolyglotException message in the IllegalArgumentException — it reports the line/column of the syntax error; fix the script there.","Validate the script locally with node --check before registering.","Ensure the script does not rely on runtime values to be syntactically valid (placeholders are fine; structural errors are not).","If the error is actually a resource-limit issue, note that validateScriptSyntax only treats true syntax errors as failures — check engine resource settings for other failures."],"exampleFix":"// before - unterminated string, syntax error\nvar x = 'hello;\nreturn x;\n// after\nvar x = 'hello';\nreturn x;","handlingStrategy":"validation","validationCode":"// Pre-validate script syntax before registering\ntry {\n    ScriptEvaluator.validateScriptSyntax(script);\n} catch (IllegalArgumentException e) {\n    // surface syntax error to the author before persistence\n}","typeGuard":null,"tryCatchPattern":"try {\n    ScriptEvaluator.validateScriptSyntax(script);\n} catch (IllegalArgumentException e) {\n    // e.getMessage() is the GraalVM syntax error with line/column -> fix the script\n}","preventionTips":["Run scripts through node --check or the engine's parser during authoring/CI.","Register scripts only after validateScriptSyntax passes.","Keep placeholder usage (${...}) structural-only; do not rely on runtime values for syntactic validity."],"tags":["script","javascript","graalvm","validation","illegal-argument","syntax-error"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}