{"record":{"id":"a07778de855934ac","repo":"alibaba/nacos","slug":"max-check-time-for-http-or-tcp-is-too-small-3000","errorCode":null,"errorMessage":"max check time for http or tcp is too small(<3000)","messagePattern":"max check time for http or tcp is too small\\(<3000\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":392,"sourceCode":"        switchDomain.setEnableAuthentication(newSwitchDomain.isEnableAuthentication());\n        switchDomain.setOverriddenServerStatus(newSwitchDomain.getOverriddenServerStatus());\n        switchDomain.setDefaultInstanceEphemeral(newSwitchDomain.isDefaultInstanceEphemeral());\n        switchDomain.setLightBeatEnabled(newSwitchDomain.isLightBeatEnabled());\n    }\n    \n    /**\n     * Validate health params.\n     *\n     * @param healthParams health params\n     */\n    public void validateHealthParams(SwitchDomain.HealthParams healthParams) {\n        if (healthParams.getMin() < SwitchDomain.HttpHealthParams.MIN_MIN) {\n            throw new IllegalArgumentException(\"min check time for http or tcp is too small(<500)\");\n        }\n        \n        if (healthParams.getMax() < SwitchDomain.HttpHealthParams.MIN_MAX) {\n            \n            throw new IllegalArgumentException(\n                \"max check time for http or tcp is too small(<3000)\");\n        }\n        \n        if (healthParams.getFactor() < 0 || healthParams.getFactor() > 1) {\n            \n            throw new IllegalArgumentException(\"malformed factor\");\n        }\n    }\n    \n    private void updateWithConsistency(SwitchDomain tempSwitchDomain) throws NacosException {\n        try {\n            final BatchWriteRequest req = new BatchWriteRequest();\n            String switchDomainKey = KeyBuilder.getSwitchDomainKey();\n            Datum datum = Datum.createDatum(switchDomainKey, tempSwitchDomain);\n            req.append(ByteUtils.toBytes(switchDomainKey), serializer.serialize(datum));\n            WriteRequest operationLog = WriteRequest.newBuilder().setGroup(group())\n                .setOperation(OldDataOperation.Write.getDesc())\n                .setData(ByteString.copyFrom(serializer.serialize(req)))","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L374-L410","documentation":"Thrown by validateHealthParams when healthParams.getMax() < SwitchDomain.HttpHealthParams.MIN_MAX (3000 ms). This is the maximum health-check interval; values below 3000ms would make checks too aggressive. Applies to both http and tcp health params.","triggerScenarios":"PUT /v3/admin/ns/operator/switches with entry=httpHealthParams or tcpHealthParams and a valid JSON whose 'max' field is < 3000, e.g. {\"min\":500,\"max\":2000,\"factor\":0.85}.","commonSituations":"Setting max too low when trying to speed up health checks, or max < min.","solutions":["Set the 'max' field to >= 3000 (milliseconds).","Ensure max >= min >= 500."],"exampleFix":"// before\nPUT /v3/admin/ns/operator/switches?entry=tcpHealthParams&value={\"min\":500,\"max\":2000,\"factor\":0.85}\n// after\nPUT /v3/admin/ns/operator/switches?entry=tcpHealthParams&value={\"min\":500,\"max\":5000,\"factor\":0.85}","handlingStrategy":"validation","validationCode":"if (healthParams.getMax() < 3000) {\n    throw new IllegalArgumentException(\"Health check max must be >= 3000ms\");\n}","typeGuard":"function isValidMax(max: number): boolean {\n  return max >= 3000;\n}","tryCatchPattern":"try {\n  operatorV2Impl.updateSwitch(entry, json, debug);\n} catch (NacosApiException e) {\n  if (e.getMessage().includes(\"max check time\")) {\n    params.max = 3000;\n    json = JSON.stringify(params);\n  }\n}","preventionTips":["Keep health-check max >= 3000ms.","Ensure max >= min."],"tags":["naming","switch","validation","health-params"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}