{"record":{"id":"c6e91045937c0d10","repo":"alibaba/nacos","slug":"callinterfaces-must-not-be-null","errorCode":null,"errorMessage":"callInterfaces must not be null","messagePattern":"callInterfaces must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/ai/model/agent/AgentDraftUpdateRequest.java","lineNumber":49,"sourceCode":"    \n    private static final long serialVersionUID = 1L;\n    \n    private String agentName;\n    \n    private String version;\n    \n    private List<AgentCallInterface> callInterfaces;\n    \n    private String changeDescription;\n    \n    /**\n     * Validate the draft identity and content.\n     */\n    public void validate() {\n        AgentAdminRequestUtils.validateIdentity(agentName);\n        AgentAdminRequestUtils.validateVersion(version);\n        if (callInterfaces == null) {\n            throw new IllegalArgumentException(\"callInterfaces must not be null\");\n        }\n    }\n    \n    public String getAgentName() {\n        return agentName;\n    }\n    \n    public void setAgentName(String agentName) {\n        this.agentName = agentName;\n    }\n    \n    public String getVersion() {\n        return version;\n    }\n    \n    public void setVersion(String version) {\n        this.version = version;\n    }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/ai/model/agent/AgentDraftUpdateRequest.java#L31-L67","documentation":"AgentDraftUpdateRequest.validate requires that callInterfaces is non-null when updating a draft. Unlike the create path (which allows basedOnVersion as an alternative), the update path mandates explicit interface content — you cannot update a draft without specifying its call interfaces.","triggerScenarios":"Calling draftUpdate.validate() when callInterfaces is null. Happens when a partial update (e.g. only changing status or metadata) is attempted without including the full callInterfaces list.","commonSituations":"A PATCH-style update intent that omits callInterfaces because the caller only wants to change metadata. A serialization issue where the field was not populated from the request body. Assuming the update is a delta rather than a full replacement.","solutions":["Always include the complete callInterfaces list in an AgentDraftUpdateRequest, even when updating other fields.","Fetch the current draft first, merge your changes, then send the full callInterfaces list.","Use a different update endpoint (e.g. labels-only or status-only) if you only need to change those fields."],"exampleFix":"// before\nrequest.setCallInterfaces(null); // only updating labels\nrequest.validate(); // throws\n\n// after -- include full interface list\nList<AgentCallInterface> current = fetchDraft(name, version).getCallInterfaces();\nrequest.setCallInterfaces(current);\nrequest.validate(); // ok","handlingStrategy":"validation","validationCode":"if (request.getCallInterfaces() == null) {\n    // fetch current and populate, or reject\n    List<AgentCallInterface> current = agentAdminService\n        .getDraft(request.getAgentName(), request.getVersion())\n        .getCallInterfaces();\n    request.setCallInterfaces(current);\n}","typeGuard":"public static boolean isDraftUpdateValid(AgentDraftUpdateRequest req) {\n    return req.getCallInterfaces() != null;\n}","tryCatchPattern":"try {\n    request.validate();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"callInterfaces must not be null\")) {\n        return badRequest(\"callInterfaces is required for draft updates\");\n    }\n    throw e;\n}","preventionTips":["Always send the full callInterfaces list in draft updates.","Fetch the current draft and merge changes before updating.","Use dedicated endpoints for partial updates (status, labels)."],"tags":["agent-admin","validation","draft","non-null"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}