{"record":{"id":"4c6d485569c32822","repo":"flowable/flowable-engine","slug":"either-channeldefinitionid-or-channeldefinitionkey","errorCode":null,"errorMessage":"Either channelDefinitionId or channelDefinitionKey is required.","messagePattern":"Either channelDefinitionId or channelDefinitionKey is required\\.","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/runtime/EventInstanceCollectionResource.java","lineNumber":131,"sourceCode":"        } else {\n            channelModel = repositoryService.getChannelModelByKey(request.getChannelDefinitionKey());\n        }\n\n        eventRegistry.eventReceived((InboundChannelModel) channelModel, request.getEventPayload().toString());\n    }\n\n    protected void validateRequestParameters(@RequestBody EventInstanceCreateRequest request) {\n        if (request.getEventDefinitionId() == null && request.getEventDefinitionKey() == null) {\n            throw new FlowableIllegalArgumentException(\"Either eventDefinitionId or eventDefinitionKey is required.\");\n        }\n\n        int paramsSet = ((request.getEventDefinitionId() != null) ? 1 : 0) + ((request.getEventDefinitionKey() != null) ? 1 : 0);\n        if (paramsSet > 1) {\n            throw new FlowableIllegalArgumentException(\"Only one of eventDefinitionId or eventDefinitionKey should be set.\");\n        }\n\n        if (request.getChannelDefinitionId() == null && request.getChannelDefinitionKey() == null) {\n            throw new FlowableIllegalArgumentException(\"Either channelDefinitionId or channelDefinitionKey is required.\");\n        }\n\n        paramsSet = ((request.getChannelDefinitionId() != null) ? 1 : 0) + ((request.getChannelDefinitionKey() != null) ? 1 : 0);\n        if (paramsSet > 1) {\n            throw new FlowableIllegalArgumentException(\"Only one of eventDefinitionId or eventDefinitionKey should be set.\");\n        }\n    }\n}\n","sourceCodeStart":113,"sourceCodeEnd":140,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-rest/src/main/java/org/flowable/eventregistry/rest/service/api/runtime/EventInstanceCollectionResource.java#L113-L140","documentation":"REST request validation in EventInstanceCollectionResource.validateRequestParameters: the request identified an event definition but supplied neither channelDefinitionId nor channelDefinitionKey, so the inbound channel through which to fire the event cannot be resolved.","triggerScenarios":"POST body with event definition set but both channelDefinitionId and channelDefinitionKey null/missing.","commonSituations":"Forgetting channel fields in the JSON payload; typos in channel property names; building requests from partial configuration where channel info is absent.","solutions":["Add channelDefinitionId or channelDefinitionKey to the request body.","Verify JSON property names match EventInstanceCreateRequest.","Confirm the channel model is deployed and its id/key is correct.","Validate request body client-side before calling the endpoint."],"exampleFix":"// before\n{ \"eventDefinitionKey\": \"myEvent\", \"eventPayload\": {} }\n// after\n{ \"eventDefinitionKey\": \"myEvent\", \"channelDefinitionKey\": \"inboundCh\", \"eventPayload\": {} }","handlingStrategy":"validation","validationCode":"if (req.getChannelDefinitionId() == null && req.getChannelDefinitionKey() == null) {\n    throw new IllegalArgumentException(\"Set channelDefinitionId or channelDefinitionKey\");\n}","typeGuard":"null","tryCatchPattern":"try {\n    createEventInstance(req);\n} catch (FlowableIllegalArgumentException e) {\n    logger.error(\"Missing channel definition in request\", e);\n}","preventionTips":["Always include channel identification in event payloads","Source channel ids from deployed channel model config","Validate the body shape against the API model"],"tags":["rest","validation","bad-request"],"backgroundTag":"missing-required-argument","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"}