{"record":{"id":"c22be5cde50652a6","repo":"alibaba/nacos","slug":"agent-scope-must-be-public-or-private","errorCode":null,"errorMessage":"Agent scope must be PUBLIC or PRIVATE","messagePattern":"Agent scope must be PUBLIC or PRIVATE","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentOperationService.java","lineNumber":986,"sourceCode":"    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);\n        }\n        if (StringUtils.isNotBlank(scope)\n            && !VisibilityConstants.SCOPE_PUBLIC.equals(scope)\n            && !VisibilityConstants.SCOPE_PRIVATE.equals(scope)) {\n            throw new IllegalArgumentException(\"Agent scope must be PUBLIC or PRIVATE\");\n        }\n        if (StringUtils.isNotBlank(orderBy) && !\"download_count\".equals(orderBy)) {\n            throw new IllegalArgumentException(\"Unsupported Agent orderBy: \" + orderBy);\n        }\n    }\n    \n    private NacosApiException illegalState(String message) {\n        return new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.ILLEGAL_STATE,\n            message);\n    }\n    \n    private NacosApiException conflict(String message) {\n        return new NacosApiException(NacosException.CONFLICT, ErrorCode.RESOURCE_CONFLICT,\n            message);\n    }\n}\n","sourceCodeStart":968,"sourceCodeEnd":1003,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentOperationService.java#L968-L1003","documentation":"Error \"Agent scope must be PUBLIC or PRIVATE\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at ai/src/main/java/com/alibaba/nacos/ai/service/agent/AgentOperationService.java:986 when the library encounters an invalid state.","commonSituations":"Setting an Agent scope to a value other than PUBLIC or PRIVATE.","solutions":["Correct the invalid value for agent scope to match the expected format or allowed set, then 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"}