{"record":{"id":"7b52fa33518e77c5","repo":"flowable/flowable-engine","slug":"variable-name-is-already-present-on-execution","errorCode":null,"errorMessage":"Variable '${name}' is already present on execution '${executionId}'.","messagePattern":"Variable '(.+?)' is already present on execution '(.+?)'\\.","errorType":"validation","errorClass":"FlowableConflictException","httpStatus":409,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseVariableCollectionResource.java","lineNumber":130,"sourceCode":"            for (RestVariable var : inputVariables) {\n                // Validate if scopes match\n                varScope = var.getVariableScope();\n                if (var.getName() == null) {\n                    throw new FlowableIllegalArgumentException(\"Variable name is required\");\n                }\n\n                if (varScope == null) {\n                    varScope = RestVariableScope.LOCAL;\n                }\n                if (sharedScope == null) {\n                    sharedScope = varScope;\n                }\n                if (varScope != sharedScope) {\n                    throw new FlowableIllegalArgumentException(\"Only allowed to update multiple variables in the same scope.\");\n                }\n\n                if (!override && hasVariableOnScope(execution, var.getName(), varScope)) {\n                    throw new FlowableConflictException(\"Variable '\" + var.getName() + \"' is already present on execution '\" + execution.getId() + \"'.\");\n                }\n\n                Object actualVariableValue = restResponseFactory.getVariableValue(var);\n                variablesToSet.put(var.getName(), actualVariableValue);\n            }\n\n            if (!variablesToSet.isEmpty()) {\n                if (restApiInterceptor != null) {\n                    restApiInterceptor.createExecutionVariables(execution, variablesToSet, sharedScope);\n                }\n\n                Map<String, Object> setVariables = null;\n                if (sharedScope == RestVariableScope.LOCAL) {\n                    \n                    if (async) {\n                        runtimeService.setVariablesLocalAsync(execution.getId(), variablesToSet);\n                        \n                    } else {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseVariableCollectionResource.java#L112-L148","documentation":"FlowableConflictException thrown when creating/updating variables on an execution without the 'override' flag while a variable with the same name already exists on that scope. The REST API refuses to silently overwrite an existing variable; callers must explicitly set override=true or use a different name.","triggerScenarios":"POST/PUT to /runtime/process-instances/{id}/variables or /runtime/executions/{id}/variables with override=false (or absent) and a body containing a variable whose name already exists on the execution's scope.","commonSituations":"Re-submitting a variable-set request after a partial failure; a workflow engine or script that re-sets process variables on retry; two integrations writing the same variable name; client assumes PUT semantics (idempotent overwrite) but default override is false.","solutions":["Set the override query parameter to true on the request (e.g. POST .../variables?override=true) so existing variables are replaced.","Remove or rename the duplicate variable from the request body.","Before sending, GET the existing variables and only include ones not already present, or merge values client-side.","Catch FlowableConflictException (HTTP 409) and decide per-variable whether to overwrite in a follow-up override call."],"exampleFix":"// before\nPOST /runtime/process-instances/{id}/variables\n[{\"name\":\"orderId\",\"value\":\"42\"}]\n// after\nPOST /runtime/process-instances/{id}/variables?override=true\n[{\"name\":\"orderId\",\"value\":\"42\"}]","handlingStrategy":"validation","validationCode":"const existing = await fetch(`/runtime/process-instances/${pid}/variables`).then(r => r.json());\nconst existingNames = new Set(existing.map(v => v.name));\nconst dupes = body.variables.filter(v => existingNames.has(v.name));\nif (dupes.length && !override) throw new Error(`Variables already present: ${dupes.map(d => d.name).join(',')}`);","typeGuard":null,"tryCatchPattern":"try { /* setVariables call */ } catch (e) {\n  if (e.status === 409 || /is already present on execution/.test(e.message)) {\n    // re-issue with override=true or merge values\n  } else throw e;\n}","preventionTips":["Pass override=true whenever idempotent overwrite semantics are intended","GET existing variables first and diff against your payload","Use stable, unique variable names per integration to avoid collisions","Handle HTTP 409 explicitly in retry logic instead of blind retries"],"tags":["rest-api","variables","conflict","flowable"],"backgroundTag":"invalid-state-transition","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"}