{"record":{"id":"f58b09e821bd8ee8","repo":"alibaba/nacos","slug":"initialversion-must-not-contain-read-only-projecti","errorCode":null,"errorMessage":"initialVersion must not contain read-only projection fields","messagePattern":"initialVersion must not contain read-only projection fields","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java","lineNumber":1032,"sourceCode":"        String expectedStatus) {\n        if (agent == null) {\n            throw new IllegalArgumentException(\"Agent must not be null\");\n        }\n        if (initialVersion == null) {\n            throw new IllegalArgumentException(\"initialVersion must not be null\");\n        }\n        AgentValidationUtils.validateNamespaceId(agent.getNamespaceId());\n        AgentValidationUtils.validateAgentName(agent.getAgentName());\n        AgentValidationUtils.validateVersion(initialVersion.getVersion());\n        if (agent.getVersionInfo() != null || agent.getVersionCatalog() != null\n            || agent.getMetaVersion() != null || agent.getCreateTime() != null\n            || agent.getUpdateTime() != null) {\n            throw new IllegalArgumentException(\n                \"Agent create input must not contain read-only projection fields\");\n        }\n        if (initialVersion.getContentDigest() != null || initialVersion.getCreateTime() != null\n            || initialVersion.getUpdateTime() != null) {\n            throw new IllegalArgumentException(\n                \"initialVersion must not contain read-only projection fields\");\n        }\n        if (initialVersion.getNamespaceId() != null\n            && !agent.getNamespaceId().equals(initialVersion.getNamespaceId())) {\n            throw new IllegalArgumentException(\"initialVersion namespaceId does not match Agent\");\n        }\n        if (initialVersion.getAgentName() != null\n            && !agent.getAgentName().equals(initialVersion.getAgentName())) {\n            throw new IllegalArgumentException(\"initialVersion agentName does not match Agent\");\n        }\n        if (initialVersion.getStatus() != null\n            && !expectedStatus.equals(initialVersion.getStatus())) {\n            throw new IllegalArgumentException(\"initialVersion status must be \" + expectedStatus);\n        }\n    }\n    \n    private void validateOnlineVersionInputs(String namespaceId, String agentName,\n        AgentVersionDetail version, String preferredLatest) {","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java#L1014-L1050","documentation":"Error \"initialVersion must not contain read-only projection fields\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java:1032 when the library encounters an invalid state.","commonSituations":"initialVersion contains read-only projection fields on creation.","solutions":["Review the input and runtime state for initialVersion read-only fields, correct the reported problem, and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}