{"record":{"id":"99f58cc3362e1e68","repo":"flowable/flowable-engine","slug":"error-parsing-channel-definition-json","errorCode":null,"errorMessage":"Error parsing channel definition JSON","messagePattern":"Error parsing channel definition JSON","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/ChannelDefinitionParse.java","lineNumber":90,"sourceCode":"        try (InputStreamReader in = newInputStreamReaderForSource(encoding)) {\n            String channelJson = IOUtils.toString(in);\n            channelModel = converter.convertToChannelModel(channelJson);\n\n            if (channelModel != null && channelModel.getKey() != null) {\n                ChannelDefinitionEntity channelDefinitionEntity = eventEngineConfig.getChannelDefinitionEntityManager().create();\n                channelDefinitionEntity.setCreateTime(new Date());\n                channelDefinitionEntity.setKey(channelModel.getKey());\n                channelDefinitionEntity.setCategory(channelModel.getCategory());\n                channelDefinitionEntity.setName(channelModel.getName());\n                channelDefinitionEntity.setDescription(channelModel.getDescription());\n                channelDefinitionEntity.setType(channelModel.getChannelType());\n                channelDefinitionEntity.setImplementation(channelModel.getType());\n                channelDefinitionEntity.setResourceName(name);\n                channelDefinitionEntity.setDeploymentId(deployment.getId());\n                channelDefinitions.add(channelDefinitionEntity);\n            }\n        } catch (Exception e) {\n            throw new FlowableException(\"Error parsing channel 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 ChannelDefinitionParse name(String name) {\n        this.name = name;\n        return this;\n    }\n\n    public ChannelDefinitionParse sourceInputStream(InputStream inputStream) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/ChannelDefinitionParse.java#L72-L108","documentation":"ChannelDefinitionParse.execute() reads the channel definition JSON from its StreamSource, parses it into a ChannelModel, and populates channel definition entities. Any exception in this pipeline — unreadable stream, malformed JSON, mapping errors — is wrapped in a FlowableException with this generic message, keeping the original cause attached.","triggerScenarios":"Executing a channel definition parse during deployment when the resource content is invalid JSON, the stream cannot be read, or the JSON does not match the expected ChannelModel structure.","commonSituations":"Hand-edited .channel JSON files with syntax errors (trailing commas, unquoted keys); wrong file deployed (HTML error page or YAML saved as .channel); encoding mismatches producing garbage bytes; schema changes after a Flowable upgrade.","solutions":["Validate the channel JSON with a JSON linter / JSON schema before deploying","Inspect the cause chain (getCause) to find whether it's an IO error or a JSON parse error","Confirm the file content type — it must be channel definition JSON matching the Flowable ChannelModel schema","Re-export a known-good channel definition from a working project and compare structure"],"exampleFix":"// before: channels/myChannel.channel\n{\"key\": 'myChannel', type: jms}   // invalid JSON: single quotes, unquoted value\n// after\n{\"key\": \"myChannel\", \"type\": \"jms\"}","handlingStrategy":"validation","validationCode":"try (Reader r = new InputStreamReader(new FileInputStream(channelFile), StandardCharsets.UTF_8)) {\n    new JsonParser().parse(r); // throws if invalid JSON\n}","typeGuard":null,"tryCatchPattern":"try {\n    parse.execute();\n} catch (FlowableException e) {\n    if (e.getMessage().equals(\"Error parsing channel definition JSON\")) {\n        log.error(\"Channel JSON invalid\", e.getCause());\n    }\n}","preventionTips":["Lint all .channel JSON files in CI before deployment","Keep channel files under schema control / generate them from typed models","Check e.getCause() to distinguish IO vs JSON errors"],"tags":["flowable","event-registry","json","parsing","channel"],"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-14T05:17:10.506Z"}