{"record":{"id":"375994656eb477d9","repo":"flowable/flowable-engine","slug":"variable-name-is-required-375994","errorCode":null,"errorMessage":"Variable name is required.","messagePattern":"Variable name is required\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-dmn-rest/src/main/java/org/flowable/dmn/rest/service/api/decision/DmnRuleServiceResource.java","lineNumber":318,"sourceCode":"                decisionBuilder.disableHistory();\n            }\n\n            Map<String, Object> executionResult = decisionBuilder.executeDecisionServiceWithSingleResult();\n\n            return dmnRestResponseFactory.createDmnRuleServiceResponse(executionResult);\n\n        } catch (FlowableObjectNotFoundException fonfe) {\n            throw new FlowableIllegalArgumentException(fonfe.getMessage(), fonfe);\n        }\n    }\n\n    protected Map<String, Object> composeInputVariables(List<EngineRestVariable> restVariables) {\n        Map<String, Object> inputVariables = null;\n        if (restVariables != null) {\n            inputVariables = new HashMap<>();\n            for (EngineRestVariable variable : restVariables) {\n                if (variable.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required.\");\n                }\n                inputVariables.put(variable.getName(), dmnRestResponseFactory.getVariableValue(variable));\n            }\n        }\n        return inputVariables;\n    }\n}","sourceCodeStart":300,"sourceCodeEnd":325,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-rest/src/main/java/org/flowable/dmn/rest/service/api/decision/DmnRuleServiceResource.java#L300-L325","documentation":"Thrown by composeInputVariables when an entry in the request's inputVariables/variables array has a null name. Each EngineRestVariable must carry a name so it can be mapped into the DMN input map. The whole request is rejected at validation time.","triggerScenarios":"POST to any /dmn-rule/execute-decision(-service)[/single-result] endpoint with an inputVariables array containing an object without a \"name\" property, e.g. {\"inputVariables\":[{\"value\":5}]}.","commonSituations":"Hand-written JSON missing the name field; variable objects built from generic maps where keys are {name, value} but a different key was used; bulk-converted payloads where one variable lost its name.","solutions":["Ensure every object in inputVariables has a non-null \"name\" property, e.g. {\"name\":\"amount\",\"value\":100}","Validate the array client-side before posting (each element has name)","Fix key mismatch in variable construction (must be \"name\", not \"key\" or \"variableName\")","Log the offending payload to find which variable entry lacks a name"],"exampleFix":"// before\n{\"decisionKey\":\"d1\",\"inputVariables\":[{\"value\":5}]}\n// after\n{\"decisionKey\":\"d1\",\"inputVariables\":[{\"name\":\"x\",\"value\":5}]}","handlingStrategy":"validation","validationCode":"boolean allNamed = request.inputVariables == null ||\n    request.inputVariables.stream().allMatch(v -> v.getName() != null);\nif (!allNamed) throw new IllegalArgumentException(\"every inputVariable needs a name\");","typeGuard":"const namedVars = (vars) => (vars == null || vars.every(v => typeof v.name === 'string' && v.name.length > 0));","tryCatchPattern":"try {\n    resp = client.executeDecision(req);\n} catch (HttpClientErrorException e) {\n    if (e.getResponseBodyAsString().contains(\"Variable name is required\")) {\n        throw new IllegalArgumentException(\"an input variable is missing its name\", e);\n    }\n    throw e;\n}","preventionTips":["Use a shared variable DTO with a required name field","Validate each variable entry before posting","Avoid building variables from loosely typed maps"],"tags":["rest-api","validation","dmn","variables"],"backgroundTag":"missing-required-argument","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"}