flowable/flowable-engine · error · FlowableObjectNotFoundException

No case definition found for id = '

Error message

No case definition found for id = '

What it means

After a non-null id is validated, SetCaseDefinitionCategoryCmd looks up the CaseDefinitionEntity. If no case definition exists for the given id, it throws FlowableObjectNotFoundException with the id and CaseDefinition.class.

Solutions

  1. Fetch the id via CaseDefinitionQuery (repositoryService.createCaseDefinitionQuery()) instead of hardcoding
  2. Verify the id exists in ACT_RE_CASEDEF for the connected datasource
  3. Confirm you are not passing a process definition id by mistake

Example fix

// before
repoService.setCaseDefinitionCategory(wrongId, "hr");
// after
CaseDefinition def = repoService.createCaseDefinitionQuery().caseDefinitionKey("myCase").latestVersion().singleResult();
repoService.setCaseDefinitionCategory(def.getId(), "hr");
Defensive patterns

Strategy: validation

Validate before calling

if (repoService.createCaseDefinitionQuery().caseDefinitionId(id).count() == 0) throw new IllegalStateException("Unknown case definition " + id);

Try / catch

try { repoService.setCaseDefinitionCategory(id, category); } catch (FlowableObjectNotFoundException e) { log.warn("Case definition not found: {}", id); }

Prevention

When it happens

Trigger: Calling setCaseDefinitionCategory with a fabricated, deleted, or wrong-engine definition id; using an id from a different Flowable engine (e.g. a process definition id instead of a case definition id).

Common situations: Mixing process/case definition ids; definition removed by cleanup or redeploy; id copied from a different environment's database.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetCaseDefinitionCategoryCmd.java:48

    protected String caseDefinitionId;
    protected String category;

    public SetCaseDefinitionCategoryCmd(String caseDefinitionId, String category) {
        this.caseDefinitionId = caseDefinitionId;
        this.category = category;
    }

    @Override
    public Void execute(CommandContext commandContext) {

        if (caseDefinitionId == null) {
            throw new FlowableIllegalArgumentException("Case definition id is null");
        }

        CaseDefinitionEntity caseDefinition = CommandContextUtil.getCaseDefinitionEntityManager(commandContext).findById(caseDefinitionId);

        if (caseDefinition == null) {
            throw new FlowableObjectNotFoundException("No case definition found for id = '" + caseDefinitionId + "'", CaseDefinition.class);
        }

        // Update category
        caseDefinition.setCategory(category);

        // Remove case definition from cache, it will be refetch later
        DeploymentCache<CaseDefinitionCacheEntry> caseDefinitionCache = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getCaseDefinitionCache();
        if (caseDefinitionCache != null) {
            caseDefinitionCache.remove(caseDefinitionId);
        }

        return null;
    }

    public String getCaseDefinitionId() {
        return caseDefinitionId;
    }

View on GitHub (pinned to d6d39ce1c6)