alibaba/nacos · error · IllegalArgumentException

Agent draft must not contain read-only projection fields

Error message

Agent draft must not contain read-only projection fields

What it means

Error "Agent draft must not contain read-only projection fields" thrown in alibaba/nacos.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java:790

        AgentValidationUtils.validateAgentName(agentName);
        if (draft == null) {
            throw new IllegalArgumentException("Agent draft must not be null");
        }
        AgentValidationUtils.validateVersion(draft.getVersion());
        if (draft.getNamespaceId() != null
            && !namespaceId.equals(draft.getNamespaceId())) {
            throw new IllegalArgumentException("Agent draft namespaceId does not match request");
        }
        if (draft.getAgentName() != null && !agentName.equals(draft.getAgentName())) {
            throw new IllegalArgumentException("Agent draft agentName does not match request");
        }
        if (draft.getStatus() != null
            && !AiConstants.Agent.VERSION_STATUS_DRAFT.equals(draft.getStatus())) {
            throw new IllegalArgumentException("Agent draft status must be draft");
        }
        if (draft.getContentDigest() != null || draft.getCreateTime() != null
            || draft.getUpdateTime() != null) {
            throw new IllegalArgumentException(
                "Agent draft must not contain read-only projection fields");
        }
        boolean directContent = draft.getCallInterfaces() != null;
        boolean copiedContent = StringUtils.isNotBlank(basedOnVersion);
        if (directContent == copiedContent) {
            throw new IllegalArgumentException(
                "Agent draft must contain either callInterfaces or basedOnVersion");
        }
        if (copiedContent) {
            AgentValidationUtils.validateVersion(basedOnVersion);
            if (draft.getVersion().equals(basedOnVersion)) {
                throw new IllegalArgumentException(
                    "Agent draft Version must differ from basedOnVersion");
            }
        }
    }
    
    private AgentVersionDetail normalizeSubsequentDraft(String namespaceId, String agentName,

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Review the input and runtime state for agent draft read-only fields, correct the reported problem, and retry.

When it happens

Trigger: Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java:790 when the library encounters an invalid state.

Common situations: Sending a draft that includes server-managed read-only projection fields.


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