MyCATApache/Mycat-Server · warning

timeout: format is wrong,it should be 1-2147483647…

Error message

timeout:%s format is wrong,it should be 1-2147483647 (unit:minute)

What it means

MigrateHandler handles the Mycat migrate/scheduling commands and accepts an optional timeout parameter (in minutes). If the timeout string is present but cannot be parsed as an int, or is <= 0, it replies with an error message stating the timeout must be 1-2147483647 (Integer.MAX_VALUE) minutes.

Solutions

  1. Pass a plain positive integer, e.g. -timeout=30 (minutes, 1 to 2147483647)
  2. Remove any unit suffix or spaces from the value
  3. Omit the timeout argument entirely to use the default
  4. Check the management-command syntax order so the value actually lands in the timeout parameter

Example fix

// before
migrate -timeout=30m schema.table
// after
migrate -timeout=30 schema.table
Defensive patterns

Strategy: validation

Validate before calling

// Validate the timeout argument before invoking the manager command
int timeout = Integer.parseInt(rawTimeout);
if (timeout <= 0 || rawTimeout.matches(".*[^0-9].*")) throw new IllegalArgumentException("timeout must be 1-" + Integer.MAX_VALUE);

Try / catch

// Error arrives as an error message on the management connection, not an exception;
// parse the reply and check: if (resp.contains("format is wrong")) { fix argv and resend }

Prevention

When it happens

Trigger: Executing a migrate command (e.g. via Mycat management port) like `migrate -timeout=abc ...` or `migrate -timeout=0` / negative value; NumberFormatException or the explicit timeout<=0 branch triggers the error reply.

Common situations: Typo in the timeout value; unit suffix included ('30m') so parseInt fails; zero or negative timeouts to mean 'no timeout'; copy-pasted command examples with wrong argument order.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/2fee9b31a7119b6c. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/server/handler/MigrateHandler.java:124

        String schema = "";
        if (table == null) {
            writeErrMessage(c, "table cannot be null");
            return;
        }
        if (table.contains(".")) {
            String[] split = table.split("\\.");
            schema = split[0];
            table = split[1];
        }
        if (add == null) {
            writeErrMessage(c, "add cannot be null");
            return;
        }
        if (timeoutString != null) {
            try {
                timeout = Integer.parseInt(timeoutString);
                if (timeout <= 0) {
                    throw new NumberFormatException("");
                }
            } catch (Exception e) {
                writeErrMessage(c, String.format("timeout:%s format is wrong,it should be 1-" + Integer.MAX_VALUE + " (unit:minute)", timeoutString));
                return;
            }
        }
        if (StringUtil.isEmpty(charset)) {
            charset = Charset.defaultCharset().name();
        }
        if (!Charset.isSupported(charset)) {
            writeErrMessage(c, "Not support charset " + charset);
            return;
        }
        ZkConfig zkConfig = ZkConfig.getInstance();
        boolean loadZk = "true".equalsIgnoreCase(zkConfig.getValue(ZK_CFG_FLAG));
        boolean force = "true".equalsIgnoreCase(map.get("force"));
        CuratorFramework zk = ZKUtils.getConnection();
        if (!loadZk) {

View on GitHub (pinned to 65f8d8beb7)