{"record":{"id":"ba31256ca73301bf","repo":"alibaba/nacos","slug":"agent-must-not-be-null","errorCode":null,"errorMessage":"Agent must not be null","messagePattern":"Agent 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":1016,"sourceCode":"        String changeDescription) {\n        AgentVersionDetail target = new AgentVersionDetail();\n        target.setNamespaceId(currentRow.getNamespaceId());\n        target.setAgentName(currentRow.getName());\n        target.setVersion(currentRow.getVersion());\n        target.setStatus(AiConstants.Agent.VERSION_STATUS_DRAFT);\n        target.setCallInterfaces(callInterfaces);\n        target.setAuthor(currentRow.getAuthor());\n        target.setChangeDescription(changeDescription);\n        target.setContentDigest(targetDescriptor.getContentDigest());\n        target.setCreateTime(0L);\n        target.setUpdateTime(0L);\n        AgentModelValidator.validateVersionDetail(target);\n    }\n    \n    private void validateCreateInputs(Agent agent, AgentVersionDetail initialVersion,\n        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        }","sourceCodeStart":998,"sourceCodeEnd":1034,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java#L998-L1034","documentation":"Error \"Agent must not be null\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentPersistenceService.java:1016 when the library encounters an invalid state.","commonSituations":"Calling agent creation with a null Agent object.","solutions":["Provide a non-null value for agent create input 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"}