{"record":{"id":"8b08781836847309","repo":"alibaba/nacos","slug":"500-8b0878","errorCode":"500","errorMessage":"do metadata operation failed {response.getErrMsg()}","messagePattern":"do metadata operation failed (.+?)","errorType":"exception","errorClass":"NacosRuntimeException","httpStatus":null,"severity":"critical","filePath":"naming/src/main/java/com/alibaba/nacos/naming/core/v2/metadata/NamingMetadataOperateService.java","lineNumber":148,"sourceCode":"            .setOperation(DataOperation.ADD.name())\n            .setData(ByteString.copyFrom(serializer.serialize(operation)))\n            .build();\n        submitMetadataOperation(operationLog);\n    }\n    \n    private <T> MetadataOperation<T> buildMetadataOperation(Service service) {\n        MetadataOperation<T> result = new MetadataOperation<>();\n        result.setNamespace(service.getNamespace());\n        result.setGroup(service.getGroup());\n        result.setServiceName(service.getName());\n        return result;\n    }\n    \n    private void submitMetadataOperation(WriteRequest operationLog) {\n        try {\n            Response response = cpProtocol.write(operationLog);\n            if (!response.getSuccess()) {\n                throw new NacosRuntimeException(NacosException.SERVER_ERROR,\n                    \"do metadata operation failed \" + response.getErrMsg());\n            }\n        } catch (Exception e) {\n            throw new NacosRuntimeException(NacosException.SERVER_ERROR,\n                \"do metadata operation failed\", e);\n        }\n    }\n}\n","sourceCodeStart":130,"sourceCodeEnd":157,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/core/v2/metadata/NamingMetadataOperateService.java#L130-L157","documentation":"Thrown by NamingMetadataOperateService.submitMetadataOperation when the CP protocol's write() call returns a Response with success=false. The response carries an error message (getErrMsg) which is appended. Error code 500 (SERVER_ERROR) via NacosRuntimeException. This is the explicit-failure branch — the protocol call completed but reported failure.","triggerScenarios":"Any service or instance metadata operation (create/update/delete service metadata, instance metadata) that goes through the CP (Raft) protocol and the leader rejects or fails the write. Common when the Raft leader is unavailable, the majority quorum is not met, or the log append fails.","commonSituations":"Cluster has fewer than majority nodes online (Raft cannot commit). The CP leader node is down or partitioned. JRaft log disk is full or corrupted. Network partition isolating the leader from followers. Too many concurrent metadata writes overwhelming the Raft log.","solutions":["Check cluster health: ensure a majority of CP-protocol nodes are online and can reach each other.","Inspect the Raft leader status and JRaft logs for the specific write failure (response.getErrMsg contains the detail).","Reduce concurrent metadata operation load; batch service metadata changes.","If the Raft log is corrupted, follow the JRaft recovery procedure (snapshot/log reset) for the affected group."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    metadataOperateService.submitMetadataOperation(operationLog);\n} catch (NacosRuntimeException e) {\n    if (e.getErrCode() == NacosException.SERVER_ERROR\n            && e.getMessage().contains(\"do metadata operation failed\")) {\n        // CP write rejected — check response.getErrMsg, then retry with backoff\n        // if the cluster recovers\n    } else throw e;\n}","preventionTips":["Maintain a healthy CP-protocol majority at all times.","Monitor Raft leader status and JRaft log health.","Batch metadata writes to reduce Raft log pressure."],"tags":["naming","metadata","cp-protocol","raft","server-error","write-failure"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}