{"record":{"id":"34f70179429606dd","repo":"alibaba/nacos","slug":"agentversioncontent-kind-must-be-agentversioncont","errorCode":null,"errorMessage":"AgentVersionContent kind must be {AgentVersionContent.KIND}","messagePattern":"AgentVersionContent kind must be (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/storage/AgentVersionContentSerializer.java","lineNumber":147,"sourceCode":"                \"AgentVersionContent exceeds \" + MAX_CONTENT_SIZE + \" bytes\");\n        }\n        validateStorageJsonShape(bytes);\n        final AgentVersionContent content;\n        try {\n            content = JacksonUtils.toObj(bytes, AgentVersionContent.class);\n        } catch (NacosDeserializationException e) {\n            throw new IllegalArgumentException(\"Invalid AgentVersionContent\", e);\n        }\n        validate(content);\n        return content;\n    }\n    \n    private static void validate(AgentVersionContent content) {\n        if (content == null) {\n            throw new IllegalArgumentException(\"AgentVersionContent must not be null\");\n        }\n        if (!AgentVersionContent.KIND.equals(content.getKind())) {\n            throw new IllegalArgumentException(\"AgentVersionContent kind must be \"\n                + AgentVersionContent.KIND);\n        }\n        if (!Integer.valueOf(AgentVersionContent.SCHEMA_VERSION)\n            .equals(content.getSchemaVersion())) {\n            throw new IllegalArgumentException(\"AgentVersionContent schemaVersion must be \"\n                + AgentVersionContent.SCHEMA_VERSION);\n        }\n        List<AgentCallInterface> callInterfaces = content.getCallInterfaces();\n        if (callInterfaces == null || callInterfaces.isEmpty()\n            || callInterfaces.size() > MAX_CALL_INTERFACES) {\n            throw new IllegalArgumentException(\n                \"AgentVersionContent callInterfaces must contain 1 to \" + MAX_CALL_INTERFACES\n                    + \" items\");\n        }\n        Set<String> protocols = new HashSet<String>();\n        for (AgentCallInterface callInterface : callInterfaces) {\n            AgentModelValidator.validateCallInterface(callInterface);\n            if (!protocols.add(callInterface.getProtocol())) {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/storage/AgentVersionContentSerializer.java#L129-L165","documentation":"Thrown by validate when content.getKind() does not equal the constant AgentVersionContent.KIND (\"AgentVersionContent\"). The kind field is a discriminator ensuring persisted content is self-identifying and resistant to schema confusion.","triggerScenarios":"Serializing or deserializing content whose kind field is missing, null, or set to a different string. This happens when content is built manually without setting kind, or when a JSON document from a different schema is loaded.","commonSituations":"Manually constructing AgentVersionContent without using the constructor that sets kind (the default constructor leaves kind null), or loading a JSON blob intended for a different resource type.","solutions":["Use new AgentVersionContent(callInterfaces) which sets kind and schemaVersion automatically.","If setting fields manually, call content.setKind(AgentVersionContent.KIND).","Ensure the JSON you deserialize was produced by this serializer's serialize method."],"exampleFix":"// before\nAgentVersionContent c = new AgentVersionContent();\nc.setCallInterfaces(ifaces);\n\n// after\nAgentVersionContent c = new AgentVersionContent(ifaces); // sets kind + schemaVersion","handlingStrategy":"validation","validationCode":"AgentVersionContent c = new AgentVersionContent(callInterfaces); // sets kind automatically\n// or manually:\nc.setKind(AgentVersionContent.KIND);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the parameterized constructor which sets kind and schemaVersion.","Avoid the default constructor unless you set all discriminator fields."],"tags":["validation","agent-version","schema","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}