{"record":{"id":"ae4b2a51d0dd0c4d","repo":"alibaba/nacos","slug":"invalid-param-ae4b2a","errorCode":"INVALID_PARAM","errorMessage":"parameters `agentCard` can't be null","messagePattern":"parameters `agentCard` can't be null","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/remote/handler/a2a/ReleaseAgentCardRequestHandler.java","lineNumber":84,"sourceCode":"        throws NacosException {\n        AgentRequestUtil.fillNamespaceId(request);\n        ReleaseAgentCardResponse response = new ReleaseAgentCardResponse();\n        try {\n            validateRequest(request);\n            doHandler(request, meta);\n            return response;\n        } catch (NacosException e) {\n            response.setErrorInfo(e.getErrCode(), e.getErrMsg());\n            LOGGER.error(\"[{}] Release agent card {} error: {}\", meta.getConnectionId(),\n                null == request.getAgentCard() ? null : JacksonUtils.toJson(request.getAgentCard()),\n                e.getErrMsg());\n        }\n        return response;\n    }\n    \n    private void validateRequest(ReleaseAgentCardRequest request) throws NacosApiException {\n        if (null == request.getAgentCard()) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"parameters `agentCard` can't be null\");\n        }\n        AgentRequestUtil.validateAgentCard(request.getAgentCard());\n    }\n    \n    private void doHandler(ReleaseAgentCardRequest request, RequestMeta meta)\n        throws NacosException {\n        String namespaceId = request.getNamespaceId();\n        AgentCard agentCard = request.getAgentCard();\n        LOGGER.info(\"Release new agent {}, version {} into namespaceId {} from connectionId {}.\",\n            agentCard.getName(),\n            agentCard.getVersion(), namespaceId, meta.getConnectionId());\n        a2aServerOperationService.releaseAgent(agentCard, namespaceId,\n            request.getRegistrationType(), request.isSetAsLatest());\n        LOGGER.info(\"AgentCard {} version {} released.\", agentCard.getName(),\n            agentCard.getVersion());\n    }\n}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/remote/handler/a2a/ReleaseAgentCardRequestHandler.java#L66-L102","documentation":"Thrown by the ReleaseAgentCard gRPC handler when the ReleaseAgentCardRequest carries a null `agentCard`. The agent card is the core payload for releasing (publishing) an A2A agent, so it cannot be absent. Returns INVALID_PARAM with PARAMETER_MISSING detail.","triggerScenarios":"Sending a ReleaseAgentCardRequest over gRPC where getAgentCard() is null. Validation happens first in validateRequest(); deeper field validation (AgentRequestUtil.validateAgentCard) runs only after the null check passes.","commonSituations":"Client builds the request envelope but forgets to attach the AgentCard; a JSON mapping omits the agentCard field; conditional code path skips card construction.","solutions":["Set a fully populated AgentCard on the request before sending (name, version, etc.).","Add a client-side null check on request.getAgentCard() before the gRPC call.","Use a factory method that requires the AgentCard argument so the request cannot be built without it."],"exampleFix":"// before\nReleaseAgentCardRequest req = new ReleaseAgentCardRequest();\nreq.setNamespaceId(\"public\"); // agentCard never set -> error\n\n// after\nReleaseAgentCardRequest req = new ReleaseAgentCardRequest();\nreq.setAgentCard(buildCard());","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(request.getAgentCard(), \"agentCard\");\nAgentRequestUtil.validateAgentCard(request.getAgentCard());","typeGuard":"boolean hasCard(ReleaseAgentCardRequest r) {\n    return r != null && r.getAgentCard() != null;\n}","tryCatchPattern":null,"preventionTips":["Build ReleaseAgentCardRequest only via a factory requiring the AgentCard.","Run AgentRequestUtil.validateAgentCard client-side before sending."],"tags":["a2a","grpc","validation","agent-card","parameter-missing"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}