{"record":{"id":"5eeb26a393f120b5","repo":"alibaba/nacos","slug":"agentversioncontent-callinterfaces-must-contain-1","errorCode":null,"errorMessage":"AgentVersionContent callInterfaces must contain 1 to {MAX_CALL_INTERFACES} items","messagePattern":"AgentVersionContent callInterfaces must contain 1 to (.+?) items","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/storage/AgentVersionContentSerializer.java","lineNumber":158,"sourceCode":"    }\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())) {\n                throw new IllegalArgumentException(\n                    \"Duplicate CallInterface protocol: \" + callInterface.getProtocol());\n            }\n        }\n    }\n    \n    private static Map<String, Object> toStorageProjection(AgentVersionContent content) {\n        Map<String, Object> result = new LinkedHashMap<String, Object>();\n        result.put(\"kind\", AgentVersionContent.KIND);\n        result.put(\"schemaVersion\", AgentVersionContent.SCHEMA_VERSION);\n        List<Map<String, Object>> callInterfaces = new ArrayList<Map<String, Object>>();","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/storage/AgentVersionContentSerializer.java#L140-L176","documentation":"Thrown by validate when callInterfaces is null, empty, or contains more than MAX_CALL_INTERFACES (16) entries. Each Agent Version must expose at least one and at most 16 call interfaces (protocol bindings).","triggerScenarios":"Serializing/deserializing content with zero call interfaces, a null list, or more than 16. Occurs when a publisher submits a version with no protocols or attempts to register an excessive number of protocol bindings on one version.","commonSituations":"A draft Agent Version created before any protocol interface is defined (empty list), or an automated tool generating one callInterface per protocol variant and exceeding 16.","solutions":["Ensure callInterfaces contains between 1 and 16 entries before serializing.","Add at least one AgentCallInterface with a valid protocol, descriptor media type, and endpoint source order.","If you need more than 16 protocols on one version, split into multiple versions or request a limit change via spec."],"exampleFix":"// before\nAgentVersionContent c = new AgentVersionContent(Collections.emptyList());\n\n// after\nAgentVersionContent c = new AgentVersionContent(List.of(callInterface));","handlingStrategy":"validation","validationCode":"if (callInterfaces == null || callInterfaces.isEmpty() || callInterfaces.size() > 16) {\n    throw new IllegalArgumentException(\"callInterfaces must be 1..16\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide at least one AgentCallInterface per version.","Dedupe and cap call interfaces before constructing content."],"tags":["validation","agent-version","capacity","call-interfaces","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}