flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find an app definition with id '<appDefinitionId>

Error message

Could not find an app definition with id '<appDefinitionId>

What it means

Thrown by HistoricTaskInstanceQuery.taskNameInIgnoreCase(Collection) when the passed collection is non-null but empty. An empty IN list would produce invalid or meaningless SQL, so the builder rejects it. Callers must supply at least one task name.

Source

Thrown at modules/flowable-app-engine-rest/src/main/java/org/flowable/app/rest/service/api/repository/AppDefinitionResource.java:61

    protected AppRestResponseFactory appRestResponseFactory;

    @Autowired
    protected AppRepositoryService appRepositoryService;
    
    @Autowired(required=false)
    protected AppRestApiInterceptor restApiInterceptor;

    @ApiOperation(value = "Get a app definition", tags = { "App Definitions" })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates the app definition was found returned."),
            @ApiResponse(code = 404, message = "Indicates the app definition was not found.")
    })
    @GetMapping(value = "/app-repository/app-definitions/{appDefinitionId}", produces = "application/json")
    public AppDefinitionResponse getAppDefinition(@ApiParam(name = "appDefinitionId") @PathVariable String appDefinitionId) {
        AppDefinition appDefinition = appRepositoryService.getAppDefinition(appDefinitionId);

        if (appDefinition == null) {
            throw new FlowableObjectNotFoundException("Could not find an app definition with id '" + appDefinitionId);
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.accessAppDefinitionInfoById(appDefinition);
        }

        return appRestResponseFactory.createAppDefinitionResponse(appDefinition);
    }
    
    @ApiOperation(value = "Execute actions for an app definition", tags = { "App Definitions" },
            notes = "Execute actions for an app definition (Update category)")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates action has been executed for the specified app definition. (category altered)"),
            @ApiResponse(code = 400, message = "Indicates no category was defined in the request body."),
            @ApiResponse(code = 404, message = "Indicates the requested app definition was not found.")
    })
    @PutMapping(value = "/app-repository/app-definitions/{appDefinitionId}", produces = "application/json")
    public AppDefinitionResponse executeAppDefinitionAction(

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Guard with !taskNames.isEmpty() before calling taskNameInIgnoreCase and omit the filter when empty.
  2. Short-circuit the whole query (return an empty result without hitting the engine) when the input list is empty.
  3. Ensure the upstream code that builds the list guarantees at least one element.

Example fix

// before
query.taskNameInIgnoreCase(names); // names can be empty

// after
if (names != null && !names.isEmpty()) {
    query.taskNameInIgnoreCase(names);
}
Defensive patterns

Strategy: validation

Validate before calling

if (names == null || names.isEmpty()) {
    return Collections.emptyList(); // or omit the filter
}
query.taskNameInIgnoreCase(names);

Type guard

static boolean isApplicable(Collection<String> c) { return c != null && !c.isEmpty(); }

Try / catch

try {
    query.taskNameInIgnoreCase(names);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().contains("empty")) { return Collections.emptyList(); }
    throw e;
}

Prevention

When it happens

Trigger: Calling taskNameInIgnoreCase(new ArrayList<>()) or taskNameInIgnoreCase(List.of()) or passing a collection that was filtered down to zero elements.

Common situations: A UI multi-select with nothing selected, an empty search-term list, or a filtered collection (stream().filter(...) with no matches) is passed directly into the query builder.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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