alibaba/canal · error · RuntimeException
auth : {} is failed
Error message
auth : {} is failed What it means
Thrown by canalConfigPoll() (GET /server_polling) when auth(user, passwd) returns false — the request's user/passwd headers don't satisfy the admin's configured credentials. Returns a generic RuntimeException.
Source
Thrown at admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/controller/PollingConfigController.java:48
String user;
@Value(value = "${canal.adminPasswd}")
String passwd;
@Autowired
PollingConfigService pollingConfigService;
/**
* 获取server全局配置
*/
@GetMapping(value = "/server_polling")
public BaseModel<CanalConfig> canalConfigPoll(@RequestHeader String user, @RequestHeader String passwd,
@RequestParam String ip, @RequestParam Integer port,
@RequestParam String md5, @RequestParam boolean register,
@RequestParam String cluster, @RequestParam String name,
@PathVariable String env) {
if (!auth(user, passwd)) {
throw new RuntimeException("auth :" + user + " is failed");
}
if (StringUtils.isEmpty(md5) && register) {
// do something
pollingConfigService.autoRegister(ip, port, cluster, StringUtils.trimToNull(name));
}
CanalConfig canalConfig = pollingConfigService.getChangedConfig(ip, port, md5);
return BaseModel.getInstance(canalConfig);
}
/**
* 获取单个instance的配置
*/
@GetMapping(value = "/instance_polling/{destination}")
public BaseModel<CanalInstanceConfig> instanceConfigPoll(@RequestHeader String user, @RequestHeader String passwd,
@PathVariable String env,
@PathVariable String destination, @RequestParam String md5) {View on GitHub (pinned to 87be50e876)
Solutions
- Set identical canal.adminUser and canal.adminPasswd on canal-admin and every canal-server polling it.
- Ensure the polling client actually sends the user/passwd request headers.
- Trim/normalize credential values to avoid whitespace mismatch.
- Note: if admin's configured passwd is empty, auth() allows any user — confirm that is not masking a config omission.
Defensive patterns
Strategy: validation
Validate before calling
// Polling client: send matching credentials
HttpHeaders headers = new HttpHeaders();
headers.set("user", adminUser);
headers.set("passwd", adminPasswd);
if (StringUtils.isBlank(adminUser) || StringUtils.isBlank(adminPasswd)) {
throw new IllegalStateException("admin credentials required for polling");
} Prevention
- Keep admin credentials identical on admin and all polling servers.
- Send user/passwd headers on every polling request.
- Decide intentionally whether an empty admin passwd (which disables auth) is acceptable.
When it happens
Trigger: A canal-server polling for global config sends wrong/missing user or passwd headers; auth() compares them against the admin's this.user/this.passwd and fails, throwing 'auth :<user> is failed'.
Common situations: canal-server's canal.adminUser/canal.adminPasswd differ from canal-admin's; headers not sent by the polling client; trailing whitespace in the header value; password regenerated on one side only.
Related errors
- something goes wrong when doing authentication: {}
- canal.adminPasswd is empty , pls check https://github.com/al
- unexpected packet type when ack is expected
- canal.adminUser is empty , pls check https://github.com/alib
- unsupported version at this client.
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/b72d81b337014b9c.
Report an issue: GitHub.