{"record":{"id":"0e184ca5565d0d3f","repo":"flowable/flowable-engine","slug":"a-script-is-required","errorCode":null,"errorMessage":"A script is required","messagePattern":"A script is required","errorType":"exception","errorClass":"FlowableIllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptEngineRequest.java","lineNumber":140,"sourceCode":"            this.additionalResolvers.add(additionalResolver);\n            return this;\n        }\n\n        /**\n         * Configure an {@link ScriptTraceEnhancer}\n         * which is called, when a ScriptTrace is created.\n         * Allows to provide additional context information for a script trace by allow to \"tag\"\n         * the script invocation with additional meta information.\n         * Script traces are produced in case of errors and/or when a {@link ScriptTraceListener} is configured.\n         */\n        public Builder traceEnhancer(ScriptTraceEnhancer enhancer) {\n            this.traceEnhancer = enhancer;\n            return this;\n        }\n\n        public ScriptEngineRequest build() {\n            if (script == null || script.isEmpty()) {\n                throw new FlowableIllegalStateException(\"A script is required\");\n            }\n            return new ScriptEngineRequest(script,\n                    language,\n                    scopeContainer,\n                    inputVariableContainer != null ? inputVariableContainer : scopeContainer,\n                    storeScriptVariables,\n                    additionalResolvers,\n                    traceEnhancer);\n        }\n    }\n\n    private ScriptEngineRequest(String script,\n            String language,\n            VariableContainer scopeContainer,\n            VariableContainer inputVariableContainer,\n            boolean storeScriptVariables,\n            List<Resolver> additionalResolvers,\n            ScriptTraceEnhancer errorTraceEnhancer) {","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/scripting/ScriptEngineRequest.java#L122-L158","documentation":"ScriptEngineRequest.Builder.build() refuses to construct a request when the script field is null or empty, throwing FlowableIllegalStateException('A script is required'). It is the builder-construction-time guard for the newer ScriptEngineRequest API.","triggerScenarios":"Calling ScriptEngineRequest.builder()...build() without script(...), or with script(\"\") — typically when the script content is loaded from a resource/variable that is empty.","commonSituations":"Externalized script file missing on classpath so an empty string was loaded; conditional code paths that skip setting the script; refactoring that renamed the script constant.","solutions":["Add .script(\"<non-empty code>\") to the builder chain before build().","Verify the resource/config supplying the script text is loaded and non-blank.","Throw a clearer domain error at load time when the script source is blank."],"exampleFix":"// before\nScriptEngineRequest req = ScriptEngineRequest.builder().language(\"javascript\").build();\n\n// after\nScriptEngineRequest req = ScriptEngineRequest.builder()\n    .language(\"javascript\")\n    .script(\"return input + 1;\")\n    .build();","handlingStrategy":"validation","validationCode":"if (script == null || script.isEmpty()) {\n    throw new IllegalStateException(\"ScriptEngineRequest requires a non-empty script before build()\");\n}","typeGuard":"boolean hasScript(String s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    ScriptEngineRequest req = builder.build();\n} catch (FlowableIllegalStateException e) {\n    throw new ConfigurationException(\"Script request builder missing script text\", e);\n}","preventionTips":["Create the builder via a helper that takes script and language as required parameters.","Assert script resource loading success before building the request.","Add builder tests covering the omitted-script case."],"tags":["scripting","builder","validation"],"backgroundTag":"empty-required-field","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}