{"record":{"id":"4577845e63c5cb9f","repo":"alibaba/canal","slug":"unknow-mode-for-monitor","errorCode":null,"errorMessage":"unknow mode : for monitor","messagePattern":"unknow mode : for monitor","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java","lineNumber":341,"sourceCode":"                        rootDir = \"../conf\";\n                    }\n\n                    if (StringUtils.equals(\"otter-canal\", System.getProperty(\"appName\"))) {\n                        monitor.setRootConf(rootDir);\n                    } else {\n                        // eclipse debug模式\n                        monitor.setRootConf(\"src/main/resources/\");\n                    }\n                    return monitor;\n                } else if (mode.isManager()) {\n                    ManagerInstanceConfigMonitor monitor = new ManagerInstanceConfigMonitor();\n                    monitor.setScanIntervalInSecond(scanInterval);\n                    monitor.setDefaultAction(defaultAction);\n                    String managerAddress = getProperty(properties, CanalConstants.CANAL_ADMIN_MANAGER);\n                    monitor.setConfigClient(getManagerClient(managerAddress));\n                    return monitor;\n                } else {\n                    throw new UnsupportedOperationException(\"unknow mode :\" + mode + \" for monitor\");\n                }\n            });\n        }\n    }\n\n    private InstanceConfig initGlobalConfig(Properties properties) {\n        String adminManagerAddress = getProperty(properties, CanalConstants.CANAL_ADMIN_MANAGER);\n        InstanceConfig globalConfig = new InstanceConfig();\n        String modeStr = getProperty(properties, CanalConstants.getInstanceModeKey(CanalConstants.GLOBAL_NAME));\n        if (StringUtils.isNotEmpty(adminManagerAddress)) {\n            // 如果指定了manager地址,则强制适用manager\n            globalConfig.setMode(InstanceMode.MANAGER);\n        } else if (StringUtils.isNotEmpty(modeStr)) {\n            globalConfig.setMode(InstanceMode.valueOf(StringUtils.upperCase(modeStr)));\n        }\n\n        String lazyStr = getProperty(properties, CanalConstants.getInstancLazyKey(CanalConstants.GLOBAL_NAME));\n        if (StringUtils.isNotEmpty(lazyStr)) {","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/deployer/src/main/java/com/alibaba/otter/canal/deployer/CanalController.java#L323-L359","documentation":"Thrown when building an instance-config monitor for a mode that is neither SPRING nor MANAGER. The computing map checks mode.isSpring() then mode.isManager(); the InstanceMode enum only defines SPRING and MANAGER, so this default branch is effectively unreachable for a well-formed config. Hitting it indicates the mode value was constructed by reflection/deserialization from an unknown token, or the enum was extended without updating this branch.","triggerScenarios":"canal.instance.global.mode (or per-instance mode) resolves to an InstanceMode other than SPRING/MANAGER. Only possible if a future enum value is added or an invalid string is coerced into the enum via valueOf-like reflection that throws instead — so in practice this branch is defensive dead code.","commonSituations":"A typo in the mode property usually fails earlier at InstanceMode.valueOf with a different exception; this branch guards a hypothetical future enum value.","solutions":["Set canal.instance.global.mode to spring or manager (the only supported values).","Check the InstanceMode enum in your Canal build for newly added values and update if on a custom fork.","Look upstream in the logs for the actual mode-resolution failure (valueOf) if this appears unreachable."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"String modeStr = properties.getProperty(CanalConstants.getInstanceModeKey(CanalConstants.GLOBAL_NAME));\nif (!\"spring\".equalsIgnoreCase(modeStr) && !\"manager\".equalsIgnoreCase(modeStr)) {\n    throw new IllegalArgumentException(\"canal.instance.global.mode must be 'spring' or 'manager', got: \" + modeStr);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set canal.instance.global.mode to spring or manager only.","Validate the mode string early in deploy scripts."],"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"}