alibaba/nacos · error · IllegalArgumentException

initialVersion must not be null

Error message

initialVersion must not be null

What it means

Error "initialVersion must not be null" thrown in alibaba/nacos.

Source

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

        target.setAgentName(currentRow.getName());
        target.setVersion(currentRow.getVersion());
        target.setStatus(AiConstants.Agent.VERSION_STATUS_DRAFT);
        target.setCallInterfaces(callInterfaces);
        target.setAuthor(currentRow.getAuthor());
        target.setChangeDescription(changeDescription);
        target.setContentDigest(targetDescriptor.getContentDigest());
        target.setCreateTime(0L);
        target.setUpdateTime(0L);
        AgentModelValidator.validateVersionDetail(target);
    }
    
    private void validateCreateInputs(Agent agent, AgentVersionDetail initialVersion,
        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");

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Provide a non-null value for initialVersion before invoking this operation.

When it happens

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

Common situations: Creating an Agent without supplying the initialVersion.


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