{"record":{"id":"2fee9b31a7119b6c","repo":"MyCATApache/Mycat-Server","slug":"timeout-s-format-is-wrong-it-should-be-1-21474836","errorCode":null,"errorMessage":"timeout:%s format is wrong,it should be 1-2147483647 (unit:minute)","messagePattern":"timeout:(.+?) format is wrong,it should be 1-2147483647 \\(unit:minute\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/java/io/mycat/server/handler/MigrateHandler.java","lineNumber":124,"sourceCode":"        String schema = \"\";\n        if (table == null) {\n            writeErrMessage(c, \"table cannot be null\");\n            return;\n        }\n        if (table.contains(\".\")) {\n            String[] split = table.split(\"\\\\.\");\n            schema = split[0];\n            table = split[1];\n        }\n        if (add == null) {\n            writeErrMessage(c, \"add cannot be null\");\n            return;\n        }\n        if (timeoutString != null) {\n            try {\n                timeout = Integer.parseInt(timeoutString);\n                if (timeout <= 0) {\n                    throw new NumberFormatException(\"\");\n                }\n            } catch (Exception e) {\n                writeErrMessage(c, String.format(\"timeout:%s format is wrong,it should be 1-\" + Integer.MAX_VALUE + \" (unit:minute)\", timeoutString));\n                return;\n            }\n        }\n        if (StringUtil.isEmpty(charset)) {\n            charset = Charset.defaultCharset().name();\n        }\n        if (!Charset.isSupported(charset)) {\n            writeErrMessage(c, \"Not support charset \" + charset);\n            return;\n        }\n        ZkConfig zkConfig = ZkConfig.getInstance();\n        boolean loadZk = \"true\".equalsIgnoreCase(zkConfig.getValue(ZK_CFG_FLAG));\n        boolean force = \"true\".equalsIgnoreCase(map.get(\"force\"));\n        CuratorFramework zk = ZKUtils.getConnection();\n        if (!loadZk) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/server/handler/MigrateHandler.java#L106-L142","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a plain positive integer, e.g. -timeout=30 (minutes, 1 to 2147483647)","Remove any unit suffix or spaces from the value","Omit the timeout argument entirely to use the default","Check the management-command syntax order so the value actually lands in the timeout parameter"],"exampleFix":"// before\nmigrate -timeout=30m schema.table\n// after\nmigrate -timeout=30 schema.table","handlingStrategy":"validation","validationCode":"// Validate the timeout argument before invoking the manager command\nint timeout = Integer.parseInt(rawTimeout);\nif (timeout <= 0 || rawTimeout.matches(\".*[^0-9].*\")) throw new IllegalArgumentException(\"timeout must be 1-\" + Integer.MAX_VALUE);","typeGuard":null,"tryCatchPattern":"// Error arrives as an error message on the management connection, not an exception;\n// parse the reply and check: if (resp.contains(\"format is wrong\")) { fix argv and resend }","preventionTips":["Pass bare integers without units for -timeout","Wrap manager commands in scripts that validate numeric args","Omit -timeout to use defaults instead of passing 0"],"tags":["cli","argument-parsing","migrate","timeout","mycat-manager"],"backgroundTag":"invalid-argument-format","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}