{"record":{"id":"508d517b3d10a02a","repo":"flowable/flowable-engine","slug":"could-not-find-a-channel-definition-with-id-cha-508d51","errorCode":null,"errorMessage":"Could not find a channel definition with id '${channelDefinitionId}'.","messagePattern":"Could not find a channel definition with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/ChannelDefinitionResourceDataResource.java","lineNumber":56,"sourceCode":"    @ApiOperation(value = \"Get a channel definition resource content\", tags = { \"Channel Definitions\" })\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates both channel definition and resource have been found and the resource data has been returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested channel definition was not found or there is no resource with the given id present in the channel definition. The status-description contains additional information.\")\n    })\n    @GetMapping(value = \"/event-registry-repository/channel-definitions/{channelDefinitionId}/resourcedata\")\n    public byte[] getChannelDefinitionResource(@ApiParam(name = \"channelDefinitionId\") @PathVariable String channelDefinitionId, HttpServletResponse response) {\n        ChannelDefinition channelDefinition = getChannelDefinitionFromRequest(channelDefinitionId);\n        return getDeploymentResourceData(channelDefinition.getDeploymentId(), channelDefinition.getResourceName(), response);\n    }\n\n    /**\n     * Returns the {@link ChannelDefinition} that is requested. Throws the right exceptions when bad request was made or definition was not found.\n     */\n    protected ChannelDefinition getChannelDefinitionFromRequest(String channelDefinitionId) {\n        ChannelDefinition channelDefinition = repositoryService.createChannelDefinitionQuery().channelDefinitionId(channelDefinitionId).singleResult();\n\n        if (channelDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a channel definition with id '\" + channelDefinitionId + \"'.\", ChannelDefinition.class);\n        }\n\n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessChannelDefinitionById(channelDefinition);\n        }\n\n        return channelDefinition;\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/repository/ChannelDefinitionResourceDataResource.java#L38-L66","documentation":"FlowableObjectNotFoundException thrown by ChannelDefinitionResourceDataResource.getChannelDefinitionFromRequest when the channel definition query (createChannelDefinitionQuery().channelDefinitionId(id).singleResult()) returns null. The id provided for a channel-definition resource-data request does not match any deployed channel definition.","triggerScenarios":"GET /event-registry-repository/repository/channel-definitions/{channelDefinitionId}/resource (or model/xml resource endpoints) with a nonexistent id.","commonSituations":"Ids from a previous deployment version, ids copied from a different database/environment, or typos in manually constructed URLs.","solutions":["Fetch valid ids from the channel-definitions collection endpoint first.","Check the datasource/tenant configuration so the query runs against the right database.","Redeploy the channel definition if the target environment never received it."],"exampleFix":"// before\nChannelDefinition cd = repoService.createChannelDefinitionQuery().channelDefinitionId(id).singleResult();\n// after\nChannelDefinition cd = repoService.createChannelDefinitionQuery().channelDefinitionId(id).singleResult();\nif (cd == null) throw new ResponseStatusException(NOT_FOUND, \"unknown channelDefinitionId \" + id); // validate before deep calls","handlingStrategy":"try-catch","validationCode":"boolean exists = repositoryService.createChannelDefinitionQuery().channelDefinitionId(id).count() > 0;","typeGuard":null,"tryCatchPattern":"try { ... } catch (FlowableObjectNotFoundException e) { return ResponseEntity.status(404).build(); }","preventionTips":["Fetch ids from the channel-definitions list endpoint before resource requests","Re-sync ids after redeploys or DB refreshes"],"tags":["rest-api","not-found","channel-definition"],"backgroundTag":"entity-not-found","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"}