{"record":{"id":"58740060616621ca","repo":"flowable/flowable-engine","slug":"variable-name-is-required-587400","errorCode":null,"errorMessage":"Variable name is required.","messagePattern":"Variable name is required\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceCollectionResource.java","lineNumber":355,"sourceCode":"        if (paramsSet > 1) {\n            throw new FlowableIllegalArgumentException(\"Only one of caseDefinitionId or caseDefinitionKey should be set.\");\n        }\n\n        if (request.isTenantSet()) {\n            // Tenant-id can only be used with either key or message\n            if (request.getCaseDefinitionId() != null) {\n                throw new FlowableIllegalArgumentException(\"TenantId can only be used with either caseDefinitionKey.\");\n            }\n        }\n\n        Map<String, Object> startVariables = null;\n        Map<String, Object> transientVariables = null;\n        Map<String, Object> startFormVariables = null;\n        if (request.getStartFormVariables() != null) {\n            startFormVariables = new HashMap<>();\n            for (RestVariable variable : request.getStartFormVariables()) {\n                if (variable.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required.\");\n                }\n                startFormVariables.put(variable.getName(), restResponseFactory.getVariableValue(variable));\n            }\n\n        }\n\n        if (request.getVariables() != null) {\n            startVariables = new HashMap<>();\n            for (RestVariable variable : request.getVariables()) {\n                if (variable.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required.\");\n                }\n                startVariables.put(variable.getName(), restResponseFactory.getVariableValue(variable));\n            }\n        }\n\n        if (request.getTransientVariables() != null) {\n            transientVariables = new HashMap<>();","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceCollectionResource.java#L337-L373","documentation":"Each entry in startFormVariables must carry a name. createCaseInstance iterates request.getStartFormVariables() and throws FlowableIllegalArgumentException (HTTP 400) if any RestVariable has a null name, since an unnamed variable cannot be bound to the case start form.","triggerScenarios":"POST /cmmn-runtime/case-instances where any object in the startFormVariables array lacks a \"name\" property (name null/absent).","commonSituations":"Hand-written JSON entries with only \"value\" set, form serialization code that drops empty field names, list construction that appends placeholder RestVariable objects.","solutions":["Add the missing \"name\" property to every object in startFormVariables","Filter out entries with null/blank names on the client before sending","Fix form serialization so field names are always included","Validate the request payload before posting"],"exampleFix":"// before\n{\"caseDefinitionKey\":\"myCase\",\"startFormVariables\":[{\"value\":42}]}\n// after\n{\"caseDefinitionKey\":\"myCase\",\"startFormVariables\":[{\"name\":\"amount\",\"value\":42}]}","handlingStrategy":"validation","validationCode":"if (request.getStartFormVariables() != null) {\n    request.getStartFormVariables().stream()\n        .filter(v -> v.getName() == null || v.getName().isEmpty())\n        .findAny()\n        .ifPresent(v -> { throw new IllegalArgumentException(\"All startFormVariables need a name\"); });\n}","typeGuard":"boolean hasName(RestVariable v) { return v != null && v.getName() != null && !v.getName().trim().isEmpty(); }","tryCatchPattern":"try {\n    startCase(request);\n} catch (HttpClientErrorException.BadRequest e) {\n    if (e.getResponseBodyAsString().contains(\"Variable name is required\")) {\n        log.error(\"A variable entry without name was sent\");\n    }\n}","preventionTips":["Always set name when constructing RestVariable objects","Filter out null-named entries before sending","Validate payload with a JSON schema requiring name"],"tags":["rest","validation","variable","cmmn"],"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"}