alibaba/nacos · critical · NacosRuntimeException

500

500

Error message

do metadata operation failed {response.getErrMsg()}

What it means

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.

Source

Thrown at naming/src/main/java/com/alibaba/nacos/naming/core/v2/metadata/NamingMetadataOperateService.java:148

            .setOperation(DataOperation.ADD.name())
            .setData(ByteString.copyFrom(serializer.serialize(operation)))
            .build();
        submitMetadataOperation(operationLog);
    }
    
    private <T> MetadataOperation<T> buildMetadataOperation(Service service) {
        MetadataOperation<T> result = new MetadataOperation<>();
        result.setNamespace(service.getNamespace());
        result.setGroup(service.getGroup());
        result.setServiceName(service.getName());
        return result;
    }
    
    private void submitMetadataOperation(WriteRequest operationLog) {
        try {
            Response response = cpProtocol.write(operationLog);
            if (!response.getSuccess()) {
                throw new NacosRuntimeException(NacosException.SERVER_ERROR,
                    "do metadata operation failed " + response.getErrMsg());
            }
        } catch (Exception e) {
            throw new NacosRuntimeException(NacosException.SERVER_ERROR,
                "do metadata operation failed", e);
        }
    }
}

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Check cluster health: ensure a majority of CP-protocol nodes are online and can reach each other.
  2. Inspect the Raft leader status and JRaft logs for the specific write failure (response.getErrMsg contains the detail).
  3. Reduce concurrent metadata operation load; batch service metadata changes.
  4. If the Raft log is corrupted, follow the JRaft recovery procedure (snapshot/log reset) for the affected group.
Defensive patterns

Strategy: retry

Try / catch

try {
    metadataOperateService.submitMetadataOperation(operationLog);
} catch (NacosRuntimeException e) {
    if (e.getErrCode() == NacosException.SERVER_ERROR
            && e.getMessage().contains("do metadata operation failed")) {
        // CP write rejected — check response.getErrMsg, then retry with backoff
        // if the cluster recovers
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/8b08781836847309. Report an issue: GitHub.