alibaba/nacos · error · IllegalArgumentException

initialVersion must not contain read-only projection fields

Error message

initialVersion must not contain read-only projection fields

What it means

Error "initialVersion 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:1032

        String expectedStatus) {
        if (agent == null) {
            throw new IllegalArgumentException("Agent must not be null");
        }
        if (initialVersion == null) {
            throw new IllegalArgumentException("initialVersion must not be null");
        }
        AgentValidationUtils.validateNamespaceId(agent.getNamespaceId());
        AgentValidationUtils.validateAgentName(agent.getAgentName());
        AgentValidationUtils.validateVersion(initialVersion.getVersion());
        if (agent.getVersionInfo() != null || agent.getVersionCatalog() != null
            || agent.getMetaVersion() != null || agent.getCreateTime() != null
            || agent.getUpdateTime() != null) {
            throw new IllegalArgumentException(
                "Agent create input must not contain read-only projection fields");
        }
        if (initialVersion.getContentDigest() != null || initialVersion.getCreateTime() != null
            || initialVersion.getUpdateTime() != null) {
            throw new IllegalArgumentException(
                "initialVersion must not contain read-only projection fields");
        }
        if (initialVersion.getNamespaceId() != null
            && !agent.getNamespaceId().equals(initialVersion.getNamespaceId())) {
            throw new IllegalArgumentException("initialVersion namespaceId does not match Agent");
        }
        if (initialVersion.getAgentName() != null
            && !agent.getAgentName().equals(initialVersion.getAgentName())) {
            throw new IllegalArgumentException("initialVersion agentName does not match Agent");
        }
        if (initialVersion.getStatus() != null
            && !expectedStatus.equals(initialVersion.getStatus())) {
            throw new IllegalArgumentException("initialVersion status must be " + expectedStatus);
        }
    }
    
    private void validateOnlineVersionInputs(String namespaceId, String agentName,
        AgentVersionDetail version, String preferredLatest) {

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Review the input and runtime state for initialVersion 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:1032 when the library encounters an invalid state.

Common situations: initialVersion contains read-only projection fields on creation.


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