alibaba/canal · error · CanalException

requestGet for canal config error: {}

Error message

requestGet for canal config error: {}

What it means

Thrown inside PlainCanalConfigClient.doQuery when the Admin server responds with valid JSON but a non-OK code (code != HttpHelper.REST_STATE_OK). It means the Admin API explicitly rejected the config request and returned an error message, which is surfaced verbatim in resp.message. This is an application-level rejection, distinct from a transport-level failure (which would bubble up as error 360).

Source

Thrown at instance/manager/src/main/java/com/alibaba/otter/canal/instance/manager/plain/PlainCanalConfigClient.java:128

        try {
            ResponseModel<CanalConfig> config = doQuery(url);
            return processData(config.data);
        } catch (Throwable e) {
            throw new CanalException("load manager config failed.", e);
        }
    }

    private ResponseModel<CanalConfig> doQuery(String url) {
        Map<String, String> heads = new HashMap<>();
        heads.put("user", user);
        heads.put("passwd", passwd);
        String response = httpHelper.get(url, heads, REQUEST_TIMEOUT);
        ResponseModel<CanalConfig> resp = JSON.parseObject(response,
            new TypeReference<ResponseModel<CanalConfig>>() {
            });

        if (!HttpHelper.REST_STATE_OK.equals(resp.code)) {
            throw new CanalException("requestGet for canal config error: " + resp.message);
        }

        return resp;
    }

    private PlainCanal processData(CanalConfig config) throws IOException, NoSuchAlgorithmException {
        Properties properties = new Properties();
        String md5 = null;
        String status = null;
        if (config != null && StringUtils.isNotEmpty(config.content)) {
            md5 = SecurityUtil.md5String(config.content);
            status = config.status;
            properties.load(new ByteArrayInputStream(config.content.getBytes(StandardCharsets.UTF_8)));
        } else {
            // null代表没有新配置变更
            return null;
        }

View on GitHub (pinned to 87be50e876)

Solutions

  1. Read resp.message from the exception text (it is appended after 'requestGet for canal config error: ') to get the Admin's stated reason.
  2. If it indicates auth, fix canal.manager.user / canal.manager.password to match an Admin account.
  3. If it indicates unknown instance, register the destination in Canal Admin or correct the destination name.
  4. Confirm Canal Admin and Canal Server are the same release so the code/value contract for REST_STATE_OK matches.
Defensive patterns

Strategy: validation

Validate before calling

// verify credentials/destination against admin before relying on config
// (canal admin has no public pre-check; validate by performing the request and inspecting code)
ResponseModel<?> r = doQueryOnce(url); // your wrapper
if (!HttpHelper.REST_STATE_OK.equals(r.code)) {
    throw new IllegalStateException("admin rejected config: " + r.message);
}

Try / catch

try {
    return configClient.findInstance(destination, md5);
} catch (CanalException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("requestGet for canal config error:")) {
        // application-level rejection; surface admin's message to ops
        alertOps(e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: doQuery(url) succeeds in fetching and parsing the response, but ResponseModel.code is not equal to REST_STATE_OK. Happens on findServer/findInstance/findInstances when the Admin server returns an error envelope, e.g. authentication failure, unknown destination, or internal Admin error.

Common situations: Wrong user/passwd in canal.manager.* (Admin returns an auth-failed code), requesting an instance_polling for a destination that does not exist in Admin, or the Admin server has an internal error (DB down) and returns code 500-equivalent with a message.

Related errors


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/93a7568cc17604b9. Report an issue: GitHub.