{"record":{"id":"5344471f70ec9dce","repo":"flowable/flowable-engine","slug":"error-parsing-event-definition-json","errorCode":null,"errorMessage":"Error parsing event definition JSON","messagePattern":"Error parsing event definition JSON","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java","lineNumber":84,"sourceCode":"\n    public EventDefinitionParse execute(EventRegistryEngineConfiguration eventEngineConfig) {\n        String encoding = eventEngineConfig.getXmlEncoding();\n        EventJsonConverter converter = eventEngineConfig.getEventJsonConverter();\n\n        try (InputStreamReader in = newInputStreamReaderForSource(encoding)) {\n            String eventJson = IOUtils.toString(in);\n            eventModel = converter.convertToEventModel(eventJson);\n\n            if (eventModel != null && eventModel.getKey() != null) {\n                EventDefinitionEntity eventDefinitionEntity = eventEngineConfig.getEventDefinitionEntityManager().create();\n                eventDefinitionEntity.setKey(eventModel.getKey());\n                eventDefinitionEntity.setName(eventModel.getName());\n                eventDefinitionEntity.setResourceName(name);\n                eventDefinitionEntity.setDeploymentId(deployment.getId());\n                eventDefinitions.add(eventDefinitionEntity);\n            }\n        } catch (Exception e) {\n            throw new FlowableException(\"Error parsing event definition JSON\", e);\n        }\n        return this;\n    }\n\n    private InputStreamReader newInputStreamReaderForSource(String encoding) throws UnsupportedEncodingException {\n        if (encoding != null) {\n            return new InputStreamReader(streamSource.getInputStream(), encoding);\n        } else {\n            return new InputStreamReader(streamSource.getInputStream());\n        }\n    }\n\n    public EventDefinitionParse name(String name) {\n        this.name = name;\n        return this;\n    }\n\n    public EventDefinitionParse sourceInputStream(InputStream inputStream) {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java#L66-L102","documentation":"EventDefinitionParse.execute() reads the event definition JSON, converts it into an EventModel via the event model JSON converter, and builds EventDefinitionEntity instances. Any exception in this pipeline — stream read failures, invalid JSON, schema mismatches — is wrapped in a FlowableException with this message, preserving the underlying cause.","triggerScenarios":"Deploying an event definition resource whose content is not valid event-definition JSON, whose required fields (key, payload) are missing, or whose stream cannot be read/decoded.","commonSituations":".event files with JSON syntax errors; deploying a channel JSON file with an .event extension; empty or truncated files from a failed build copy; Flowable version upgrades changing the expected event JSON schema.","solutions":["Validate the event JSON structure (must include 'key' and a valid 'payload' section) against the Flowable event definition schema","Check getCause() on the exception to distinguish IO/encoding failures from JSON parse failures","Verify the file is an event definition (not a channel definition) and is non-empty/not truncated","Lint the JSON with a standard parser to catch syntax errors before deployment"],"exampleFix":"// before: events/orderCreated.event\n{\"key\": \"orderCreated\" \"payload\": {\"customerId\": \"string\"}}  // missing comma -> parse fails\n// after\n{\"key\": \"orderCreated\", \"payload\": {\"customerId\": \"string\"}}","handlingStrategy":"validation","validationCode":"JsonObject obj = Json.parseReader(new FileReader(eventFile)).getAsJsonObject();\nif (!obj.has(\"key\") || obj.get(\"key\").getAsString().isEmpty()) {\n    throw new IllegalArgumentException(\"Event JSON missing 'key': \" + eventFile);\n}","typeGuard":null,"tryCatchPattern":"try {\n    parse.execute();\n} catch (FlowableException e) {\n    if (e.getMessage().equals(\"Error parsing event definition JSON\")) {\n        log.error(\"Event JSON invalid\", e.getCause());\n    }\n}","preventionTips":["Lint all .event JSON files in CI before deployment","Confirm extension matches content type (event vs channel definitions)","Verify files are non-empty and complete after build copy steps","Inspect e.getCause() to pinpoint JSON syntax vs schema issues"],"tags":["flowable","event-registry","json","parsing","event-definition"],"backgroundTag":"json-parse-error","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}