{"record":{"id":"a61afd27a0ea7ffe","repo":"alibaba/canal","slug":"unknown-mode","errorCode":null,"errorMessage":"unknown mode :","messagePattern":"unknown mode :","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java","lineNumber":394,"sourceCode":"        }\n\n        instanceGenerator = destination -> {\n            InstanceConfig config = instanceConfigs.get(destination);\n            if (config == null) {\n                throw new CanalServerException(\"can't find destination:\" + destination);\n            }\n\n            if (config.getMode().isManager()) {\n                PlainCanalInstanceGenerator instanceGenerator = new PlainCanalInstanceGenerator(properties);\n                instanceGenerator.setCanalConfigClient(managerClients.get(config.getManagerAddress()));\n                instanceGenerator.setSpringXml(config.getSpringXml());\n                return instanceGenerator.generate(destination);\n            } else if (config.getMode().isSpring()) {\n                SpringCanalInstanceGenerator instanceGenerator = new SpringCanalInstanceGenerator();\n                instanceGenerator.setSpringXml(config.getSpringXml());\n                return instanceGenerator.generate(destination);\n            } else {\n                throw new UnsupportedOperationException(\"unknown mode :\" + config.getMode());\n            }\n\n        };\n\n        return globalConfig;\n    }\n\n    private PlainCanalConfigClient getManagerClient(String managerAddress) {\n        return new PlainCanalConfigClient(managerAddress, this.adminUser, this.adminPasswd, this.registerIp, adminPort);\n    }\n\n    private void initInstanceConfig(Properties properties) {\n        String destinationStr = getDestinations(properties);\n        String[] destinations = StringUtils.split(destinationStr, CanalConstants.CANAL_DESTINATION_SPLIT);\n\n        for (String destination : destinations) {\n            InstanceConfig config = parseInstanceConfig(properties, destination);\n            InstanceConfig oldConfig = instanceConfigs.put(destination, config);","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java#L376-L412","documentation":"Thrown inside the instanceGenerator lambda when config.getMode() is neither MANAGER nor SPRING. Identical structure to error 293 but at instance-creation time rather than monitor-creation time. Because InstanceMode only has SPRING and MANAGER, this branch is defensive dead code unless the enum is extended.","triggerScenarios":"An InstanceConfig resolves to a mode that is not spring or manager. In practice unreachable because the enum has no other values; a bad mode string fails earlier at valueOf.","commonSituations":"Custom Canal fork that added an InstanceMode without handling it here; a deserialized InstanceConfig carrying a null mode (getMode returns null, both isManager/isSpring false).","solutions":["Ensure canal.instance.global.mode (and per-instance mode) is spring or manager.","If mode is null, set it explicitly — a null mode falls through both branches to this throw.","On a custom fork, add the new mode's instance-generation logic before the else."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"InstanceMode mode = config.getMode();\nif (mode == null || (!mode.isManager() && !mode.isSpring())) {\n    throw new IllegalArgumentException(\"Instance mode must be spring or manager, got: \" + mode);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set canal.instance.global.mode (and per-instance mode) explicitly.","A null mode falls through both branches — ensure mode is never null."],"tags":["config","instance-mode","startup","deployer"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}