alibaba/nacos · error · IllegalArgumentException

callInterfaces must not be null

Error message

callInterfaces must not be null

What it means

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.

Source

Thrown at api/src/main/java/com/alibaba/nacos/api/ai/model/agent/AgentDraftUpdateRequest.java:49

    
    private static final long serialVersionUID = 1L;
    
    private String agentName;
    
    private String version;
    
    private List<AgentCallInterface> callInterfaces;
    
    private String changeDescription;
    
    /**
     * Validate the draft identity and content.
     */
    public void validate() {
        AgentAdminRequestUtils.validateIdentity(agentName);
        AgentAdminRequestUtils.validateVersion(version);
        if (callInterfaces == null) {
            throw new IllegalArgumentException("callInterfaces must not be null");
        }
    }
    
    public String getAgentName() {
        return agentName;
    }
    
    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }
    
    public String getVersion() {
        return version;
    }
    
    public void setVersion(String version) {
        this.version = version;
    }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Always include the complete callInterfaces list in an AgentDraftUpdateRequest, even when updating other fields.
  2. Fetch the current draft first, merge your changes, then send the full callInterfaces list.
  3. Use a different update endpoint (e.g. labels-only or status-only) if you only need to change those fields.

Example fix

// before
request.setCallInterfaces(null); // only updating labels
request.validate(); // throws

// after -- include full interface list
List<AgentCallInterface> current = fetchDraft(name, version).getCallInterfaces();
request.setCallInterfaces(current);
request.validate(); // ok
Defensive patterns

Strategy: validation

Validate before calling

if (request.getCallInterfaces() == null) {
    // fetch current and populate, or reject
    List<AgentCallInterface> current = agentAdminService
        .getDraft(request.getAgentName(), request.getVersion())
        .getCallInterfaces();
    request.setCallInterfaces(current);
}

Type guard

public static boolean isDraftUpdateValid(AgentDraftUpdateRequest req) {
    return req.getCallInterfaces() != null;
}

Try / catch

try {
    request.validate();
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("callInterfaces must not be null")) {
        return badRequest("callInterfaces is required for draft updates");
    }
    throw e;
}

Prevention

When it happens

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

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

Related errors


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