flowable/flowable-engine · error · FlowableObjectNotFoundException

Execution '" + execution.getId() + "' does not have a…

Error message

Execution '" + execution.getId() + "' does not have a variable with name: '" + variableName + "'.

What it means

Variable lookup failure in BaseExecutionVariableResource: the execution was found, but neither it (local scope) nor its parent (global scope) holds a variable with the requested name, so the GET/PUT on that variable cannot proceed.

Solutions

  1. List all variables with GET /runtime/executions/{id}/variables and confirm the exact name
  2. Check the variable's scope — query the correct execution (e.g. child execution) or use variableScope=local/global explicitly
  3. Ensure the variable is created before reading it, or handle FlowableObjectNotFoundException as 'not yet set'

Example fix

// before
GET /runtime/executions/123/variables/coutner   // typo -> 404
// after
GET /runtime/executions/123/variables  // discover correct names first, then GET /variables/counter
Defensive patterns

Strategy: validation

Validate before calling

RestVariable[] vars = rest.getForObject(base + "/runtime/executions/" + id + "/variables", RestVariable[].class);
boolean exists = Arrays.stream(vars).anyMatch(v -> v.getName().equals(variableName));
if (!exists) throw new IllegalArgumentException("Variable '" + variableName + "' is not set on execution " + id);

Type guard

null

Try / catch

try { return client.getExecutionVariable(id, name); } catch (HttpClientErrorException.NotFound e) { return Optional.empty(); } // treat unset variable as absent

Prevention

When it happens

Trigger: GET /runtime/executions/{id}/variables/{name}, or internal calls from setBinaryVariable/setSimpleVariable reading current state, where the variableName is absent from the execution.

Common situations: Variable name typo; variable was set on a child (concurrent) execution as local, not on the requested one; variable removed on process completion; case-sensitivity mismatch.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/e482480843ce71c3. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/process/BaseExecutionVariableResource.java:321

                    variableFound = true;
                }
            }
        } else if (variableScope == RestVariableScope.GLOBAL) {
            // Use parent to get variables
            if (execution.getParentId() != null) {
                value = runtimeService.getVariable(execution.getParentId(), variableName);
                variableScope = RestVariableScope.GLOBAL;
                variableFound = true;
            }
        } else if (variableScope == RestVariableScope.LOCAL) {

            value = runtimeService.getVariableLocal(execution.getId(), variableName);
            variableScope = RestVariableScope.LOCAL;
            variableFound = true;
        }

        if (!variableFound) {
            throw new FlowableObjectNotFoundException("Execution '" + execution.getId() + "' does not have a variable with name: '" + variableName + "'.", VariableInstanceEntity.class);
        } else {
            return constructRestVariable(variableName, value, variableScope, execution.getId(), includeBinary);
        }
    }

    protected RestVariable constructRestVariable(String variableName, Object value, RestVariableScope variableScope, String executionId, boolean includeBinary) {

        return restResponseFactory.createRestVariable(variableName, value, variableScope, executionId, variableType, includeBinary);
    }

    protected Execution getExecutionFromRequestWithoutAccessCheck(String executionId) {
        Execution execution = runtimeService.createExecutionQuery().executionId(executionId).singleResult();
        if (execution == null) {
            throw new FlowableObjectNotFoundException("Could not find an execution with id '" + executionId + "'.", Execution.class);
        }
        
        return execution;
    }

View on GitHub (pinned to d6d39ce1c6)