{"record":{"id":"3a420ec04dfa8d8f","repo":"alibaba/nacos","slug":"serverstatussynchronizationperiodmillis-is-too-sma","errorCode":null,"errorMessage":"serverStatusSynchronizationPeriodMillis is too small(<15000)","messagePattern":"serverStatusSynchronizationPeriodMillis is too small\\(<15000\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":218,"sourceCode":"                tempSwitchDomain.setPushEnabled(enabled);\n            }\n            \n            if (entry.equals(SwitchEntry.SERVICE_STATUS_SYNC_PERIOD)) {\n                long millis = Long.parseLong(value);\n                \n                if (millis < SwitchEntry.MIN_SERVICE_SYNC_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"serviceStatusSynchronizationPeriodMillis is too small(<5000)\");\n                }\n                \n                tempSwitchDomain.setServiceStatusSynchronizationPeriodMillis(millis);\n            }\n            \n            if (entry.equals(SwitchEntry.SERVER_STATUS_SYNC_PERIOD)) {\n                long millis = Long.parseLong(value);\n                \n                if (millis < SwitchEntry.MIN_SERVER_SYNC_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"serverStatusSynchronizationPeriodMillis is too small(<15000)\");\n                }\n                \n                tempSwitchDomain.setServerStatusSynchronizationPeriodMillis(millis);\n            }\n            \n            if (entry.equals(SwitchEntry.HEALTH_CHECK_TIMES)) {\n                int times = Integer.parseInt(value);\n                \n                tempSwitchDomain.setCheckTimes(times);\n            }\n            \n            if (entry.equals(SwitchEntry.DISABLE_ADD_IP)) {\n                boolean disableAddIp = Boolean.parseBoolean(value);\n                \n                tempSwitchDomain.setDisableAddIP(disableAddIp);\n            }\n            ","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L200-L236","documentation":"Thrown when entry is 'serverStatusSynchronizationPeriodMillis' and the parsed long is below MIN_SERVER_SYNC_TIME_MIILIS (1000 ms). WARNING: the error message says '<15000' but the actual constant is 1000 (SwitchEntry.MIN_SERVER_SYNC_TIME_MIILIS = 1000) — the message is misleading and overstates the real threshold by 15x.","triggerScenarios":"PUT /v3/admin/ns/operator/switches with entry=serverStatusSynchronizationPeriodMillis and value < 1000. Note: the message claims the floor is 15000 but the actual floor is 1000.","commonSituations":"Trusting the error message literally and setting value=15001 when the real minimum is 1001. Passing seconds instead of milliseconds. Encountering the misleading message during debugging.","solutions":["Set serverStatusSynchronizationPeriodMillis to >= 1000 (1 second), NOT 15000 as the message implies.","Be aware the error message is inaccurate — the real floor is 1000ms.","File or track the message-vs-constant discrepancy as a doc bug."],"exampleFix":"// before: user sets 15001 based on misleading message\nPUT /v3/admin/ns/operator/switches?entry=serverStatusSynchronizationPeriodMillis&value=15001\n// after: 1001 is sufficient; real minimum is 1000ms\nPUT /v3/admin/ns/operator/switches?entry=serverStatusSynchronizationPeriodMillis&value=5000","handlingStrategy":"validation","validationCode":"long millis = Long.parseLong(value);\n// NOTE: actual minimum is 1000, despite the error message saying <15000\nif (millis < 1000) {\n    throw new IllegalArgumentException(\"serverStatusSyncPeriod must be >= 1000 (actual floor, not 15000)\");\n}","typeGuard":"function isValidServerStatusSyncPeriod(v: number): boolean {\n  return v >= 1000; // actual constant, NOT 15000 as message claims\n}","tryCatchPattern":"try {\n  operatorV2Impl.updateSwitch(\"serverStatusSynchronizationPeriodMillis\", String.valueOf(millis), debug);\n} catch (NacosApiException e) {\n  // message says <15000 but actual floor is 1000\n  if (e.getMessage().contains(\"too small\")) {\n    millis = 5000;\n  }\n}","preventionTips":["Do NOT trust the '<15000' in the message; the real constant is 1000ms.","Validate against the source constant, not the message text."],"tags":["naming","switch","validation","distro-sync","misleading-message"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}