{"record":{"id":"885a7914485e486f","repo":"alibaba/nacos","slug":"the-first-agent-draft-must-contain-callinterfaces","errorCode":null,"errorMessage":"The first Agent draft must contain callInterfaces and cannot use basedOnVersion","messagePattern":"The first Agent draft must contain callInterfaces and cannot use basedOnVersion","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentOperationService.java","lineNumber":963,"sourceCode":"        result.setTags(request.getTags());\n        result.setExtensions(request.getExtensions());\n        result.setStatus(AiConstants.Agent.RESOURCE_STATUS_ENABLE);\n        String currentIdentity = VisibilityHelper.resolveCurrentIdentity();\n        result.setOwner(StringUtils.isBlank(currentIdentity) ? DEFAULT_OWNER : currentIdentity);\n        result.setScope(VisibilityHelper.resolveDefaultScopeForCreate(RESOURCE_TYPE));\n        return result;\n    }\n    \n    private Agent toInitialLegacyAgent(String namespaceId, AgentDraftCreateRequest request) {\n        Agent result = toInitialAgent(namespaceId, request);\n        result.setScope(VisibilityConstants.SCOPE_PUBLIC);\n        return result;\n    }\n    \n    private void requireInitialDraftContent(AgentDraftCreateRequest request) {\n        if (StringUtils.isNotBlank(request.getBasedOnVersion())\n            || request.getCallInterfaces() == null) {\n            throw new IllegalArgumentException(\n                \"The first Agent draft must contain callInterfaces and cannot use basedOnVersion\");\n        }\n    }\n    \n    private boolean hasInitialAgentMetadata(AgentDraftCreateRequest request) {\n        return request.getDisplayName() != null || request.getDescription() != null\n            || request.getIconUrl() != null || request.getProvider() != null\n            || request.getTags() != null || request.getExtensions() != null;\n    }\n    \n    private void validateListFilters(String agentNameContains, String tag, String scope,\n        String orderBy) {\n        if (StringUtils.isNotEmpty(agentNameContains)) {\n            AgentValidationUtils.validateAgentName(agentNameContains);\n        }\n        if (StringUtils.isNotBlank(tag)\n            && tag.codePointCount(0, tag.length()) > MAX_TAG_LENGTH) {\n            throw new IllegalArgumentException(\"Invalid Agent tag filter: \" + tag);","sourceCodeStart":945,"sourceCodeEnd":981,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentOperationService.java#L945-L981","documentation":"Error \"The first Agent draft must contain callInterfaces and cannot use basedOnVersion\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentOperationService.java:963 when the library encounters an invalid state.","commonSituations":"Creating the first draft of an Agent without callInterfaces, or passing basedOnVersion on the very first draft.","solutions":["Review the input and runtime state for ai service agent draft create, 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"}