{"record":{"id":"b7edc673ee34fb0a","repo":"alibaba/nacos","slug":"agent-draft-must-not-be-null","errorCode":null,"errorMessage":"Agent draft must not be null","messagePattern":"Agent draft must not be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java","lineNumber":774,"sourceCode":"            versionInfo.setLabels(new LinkedHashMap<String, String>(derived.getLabels()));\n            \n            AgentResourceExt resourceExt = AgentResourceExtSerializer.deserialize(meta.getExt());\n            resourceExt.setVersionCatalog(derived.getVersionCatalog());\n            AiResource updateValue = buildMetaUpdateValue(meta, versionInfo, resourceExt);\n            if (resourcePersistService.updateMetaCas(namespaceId, agentName,\n                Constants.Agent.RESOURCE_TYPE_AGENT, meta.getMetaVersion(), updateValue)) {\n                return getAgent(namespaceId, agentName);\n            }\n        }\n        throw conflict(\"Agent lifecycle metadata changed concurrently: \" + agentName, null);\n    }\n    \n    private void validateSubsequentDraftInputs(String namespaceId, String agentName,\n        AgentVersionDetail draft, String basedOnVersion) {\n        AgentValidationUtils.validateNamespaceId(namespaceId);\n        AgentValidationUtils.validateAgentName(agentName);\n        if (draft == null) {\n            throw new IllegalArgumentException(\"Agent draft must not be null\");\n        }\n        AgentValidationUtils.validateVersion(draft.getVersion());\n        if (draft.getNamespaceId() != null\n            && !namespaceId.equals(draft.getNamespaceId())) {\n            throw new IllegalArgumentException(\"Agent draft namespaceId does not match request\");\n        }\n        if (draft.getAgentName() != null && !agentName.equals(draft.getAgentName())) {\n            throw new IllegalArgumentException(\"Agent draft agentName does not match request\");\n        }\n        if (draft.getStatus() != null\n            && !AiConstants.Agent.VERSION_STATUS_DRAFT.equals(draft.getStatus())) {\n            throw new IllegalArgumentException(\"Agent draft status must be draft\");\n        }\n        if (draft.getContentDigest() != null || draft.getCreateTime() != null\n            || draft.getUpdateTime() != null) {\n            throw new IllegalArgumentException(\n                \"Agent draft must not contain read-only projection fields\");\n        }","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java#L756-L792","documentation":"Error \"Agent draft must not be null\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java:774 when the library encounters an invalid state.","commonSituations":"Calling agent draft persistence with a null draft object.","solutions":["Provide a non-null value for agent draft before invoking this operation."],"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"}