{"record":{"id":"5471cd09bdabd680","repo":"alibaba/canal","slug":"canal-adminuser-is-empty-pls-check-https-githu","errorCode":null,"errorMessage":"canal.adminUser is empty , pls check https://github.com/alibaba/canal/issues/4941","messagePattern":"canal\\.adminUser is empty , pls check https://github\\.com/alibaba/canal/issues/4941","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/config/WebConfig.java","lineNumber":40,"sourceCode":"/**\n * 相关MVC拦截器配置\n *\n * @author rewerma 2019-07-13 下午05:12:16\n * @version 1.0.0\n */\n@Configuration\npublic class WebConfig implements WebMvcConfigurer {\n\n    @Value(value = \"${canal.adminUser}\")\n    private String user;\n\n    @Value(value = \"${canal.adminPasswd}\")\n    private String passwd;\n\n    @Override\n    public void addInterceptors(InterceptorRegistry registry) {\n        if (StringUtils.isEmpty(user)) {\n            throw new IllegalArgumentException(\n                \"canal.adminUser is empty , pls check https://github.com/alibaba/canal/issues/4941\");\n        }\n\n        if (StringUtils.isEmpty(passwd)) {\n            throw new IllegalArgumentException(\n                \"canal.adminPasswd is empty , pls check https://github.com/alibaba/canal/issues/4941\");\n        }\n\n        registry.addInterceptor(new HandlerInterceptor() {\n\n            @Override\n            public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,\n                                     Object o) throws Exception {\n                httpServletResponse.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n                httpServletResponse.setHeader(\"Access-Control-Allow-Methods\", \"*\");\n                httpServletResponse.setHeader(\"Access-Control-Allow-Headers\",\n                    \"Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Token\");\n                httpServletResponse.setHeader(\"Access-Control-Allow-Credentials\", \"true\");","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/config/WebConfig.java#L22-L58","documentation":"Thrown during Spring web context initialization when the `canal.adminUser` configuration property resolves to an empty string. WebConfig.addInterceptors() runs at startup and rejects an empty user before registering the auth interceptor, failing the bean wiring fast.","triggerScenarios":"Starting the canal-admin web application (Spring Boot) with `canal.adminUser` unset, empty, or missing from application.yml/application.properties. The @Value(\"${canal.adminUser}\") injection yields an empty string and addInterceptors() throws.","commonSituations":"Fresh deployment without copying canal_manager.sql-backed config; env var not exported in the run script; properties file uses a different key name; adminUser overridden to blank in a profile.","solutions":["Set `canal.adminUser` in application.yml (e.g. canal.adminUser: admin) or pass -Dcanal.adminUser=admin on the JVM command line.","Verify the property is loaded from the right profile and not shadowed by an empty spring profile value.","Check the deployment's startup script / Docker env to ensure CANAL_ADMIN_USER (or the mapped env var) is exported.","Cross-check against the GitHub issue #4941 referenced in the message for the canonical setup steps."],"exampleFix":"// before (application.yml missing or empty)\ncanal:\n  adminUser: \"\"\n\n// after\ncanal:\n  adminUser: admin\n  adminPasswd: your-password","handlingStrategy":"validation","validationCode":"// Before starting the app, assert the property is set\nif (org.apache.commons.lang.StringUtils.isBlank(System.getProperty(\"canal.adminUser\"))) {\n    throw new IllegalStateException(\"canal.adminUser must be set before startup\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a startup health-check that fails fast on missing canal.adminUser.","Document required properties in the deployment runbook.","Use Spring's @Value with a default only if an empty user is ever intentional (it is not here)."],"tags":["config","spring-boot","startup","canal-admin"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}