{"record":{"id":"4f81d06adcf88908","repo":"alibaba/nacos","slug":"min-cache-time-for-http-or-tcp-is-too-small-10000","errorCode":null,"errorMessage":"min cache time for http or tcp is too small(<10000)","messagePattern":"min cache time for http or tcp is too small\\(<10000\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":164,"sourceCode":"                    tempSwitchDomain.setPushJavaVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_PYTHON, type)) {\n                    tempSwitchDomain.setPushPythonVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_C, type)) {\n                    tempSwitchDomain.setPushCVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_GO, type)) {\n                    tempSwitchDomain.setPushGoVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_CSHARP, type)) {\n                    tempSwitchDomain.setPushCSharpVersion(version);\n                } else {\n                    throw new IllegalArgumentException(\"unsupported client type: \" + type);\n                }\n            }\n            \n            if (entry.equals(SwitchEntry.PUSH_CACHE_MILLIS)) {\n                long cacheMillis = Long.parseLong(value);\n                \n                if (cacheMillis < SwitchEntry.MIN_PUSH_CACHE_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"min cache time for http or tcp is too small(<10000)\");\n                }\n                \n                tempSwitchDomain.setDefaultPushCacheMillis(cacheMillis);\n            }\n            \n            // extremely careful while modifying this, cause it will affect all clients without pushing enabled\n            if (entry.equals(SwitchEntry.DEFAULT_CACHE_MILLIS)) {\n                long cacheMillis = Long.parseLong(value);\n                \n                if (cacheMillis < SwitchEntry.MIN_CACHE_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"min default cache time  is too small(<1000)\");\n                }\n                \n                tempSwitchDomain.setDefaultCacheMillis(cacheMillis);\n            }\n            ","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L146-L182","documentation":"Thrown when entry is 'pushCacheMillis' and the parsed long value is below MIN_PUSH_CACHE_TIME_MIILIS (10000 ms). This controls the default cache duration for push-based (HTTP/TCP) client notifications; values below 10 seconds would flood clients with push traffic.","triggerScenarios":"PUT /v3/admin/ns/operator/switches with entry=pushCacheMillis and value < 10000, e.g. value=5000, value=9999, value=0.","commonSituations":"Confusing units (passing seconds instead of milliseconds), or attempting aggressive push tuning without understanding the minimum safety floor.","solutions":["Set pushCacheMillis to >= 10000 (10 seconds).","Remember the value is in milliseconds, not seconds.","If you need faster pushes, tune the client-side cache instead of lowering this server-side floor."],"exampleFix":"// before\nPUT /v3/admin/ns/operator/switches?entry=pushCacheMillis&value=5000\n// after\nPUT /v3/admin/ns/operator/switches?entry=pushCacheMillis&value=10000","handlingStrategy":"validation","validationCode":"long cacheMillis = Long.parseLong(value);\nif (cacheMillis < 10000) {\n    throw new IllegalArgumentException(\"pushCacheMillis must be >= 10000\");\n}","typeGuard":"function isValidPushCacheMillis(v: number): boolean {\n  return v >= 10000;\n}","tryCatchPattern":"try {\n  operatorV2Impl.updateSwitch(\"pushCacheMillis\", String.valueOf(cacheMillis), debug);\n} catch (NacosApiException e) {\n  if (e.getMessage().contains(\"too small\")) {\n    cacheMillis = 10000; // clamp to minimum\n  }\n}","preventionTips":["Always pass milliseconds, never seconds.","Clamp to the documented minimum before sending."],"tags":["naming","switch","validation","cache-millis"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}