{"record":{"id":"4d0c1c7c6713d2b7","repo":"alibaba/spring-ai-alibaba","slug":"invalid-request","errorCode":"INVALID_REQUEST","errorMessage":"workspace can not be more than 10.","messagePattern":"workspace can not be more than 10\\.","errorType":"validation","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/WorkspaceServiceImpl.java","lineNumber":91,"sourceCode":"\t * @param workspace Workspace information\n\t * @return ID of the created workspace\n\t */\n\t@Override\n\tpublic String createWorkspace(Workspace workspace) {\n\t\tif (StringUtils.isBlank(workspace.getAccountId())) {\n\t\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\t\tworkspace.setAccountId(context.getAccountId());\n\t\t}\n\n\t\t// check if workspace name exists\n\t\tWorkspaceEntity entity = getWorkspaceByName(workspace.getAccountId(), workspace.getName());\n\t\tif (entity != null) {\n\t\t\tthrow new BizException(ErrorCode.WORKSPACE_NAME_EXISTS.toError());\n\t\t}\n\n\t\tlong workspaceCount = getWorkspaceCount(workspace.getAccountId());\n\t\tif (workspaceCount > MAX_WORKSPACE_PER_ACCOUNT) {\n\t\t\tthrow new BizException(ErrorCode.INVALID_REQUEST\n\t\t\t\t.toError(\"workspace can not be more than \" + MAX_WORKSPACE_PER_ACCOUNT + \".\"));\n\t\t}\n\n\t\tString workspaceId = IdGenerator.idStr();\n\t\tentity = BeanCopierUtils.copy(workspace, WorkspaceEntity.class);\n\t\tentity.setWorkspaceId(workspaceId);\n\t\tentity.setAccountId(workspace.getAccountId());\n\t\tentity.setGmtCreate(new Date());\n\t\tentity.setGmtModified(new Date());\n\t\tentity.setCreator(workspace.getAccountId());\n\t\tentity.setModifier(workspace.getAccountId());\n\n\t\tthis.save(entity);\n\n\t\t// cache it\n\t\tString key = getWorkspaceCacheKey(workspace.getAccountId(), entity.getWorkspaceId());\n\t\tredisManager.put(key, entity);\n","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/WorkspaceServiceImpl.java#L73-L109","documentation":"WorkspaceServiceImpl.createWorkspace enforces a per-account quota: MAX_WORKSPACE_PER_ACCOUNT (10). Before creating the workspace it counts existing workspaces for the account, and if workspaceCount > 10 it throws a BizException with ErrorCode.INVALID_REQUEST and the message \"workspace can not be more than 10.\". It is a business-limit rejection, thrown after the duplicate-name check (WORKSPACE_NAME_EXISTS).","triggerScenarios":"Calling createWorkspace for an account that already owns 10 or more workspaces (count >= MAX_WORKSPACE_PER_ACCOUNT, so > 10 triggers once the account holds 11+... practically, hitting the cap while creating the 11th). The check runs only after the workspace name passes the duplicate-name check.","commonSituations":"Automation or test scripts that create workspaces in a loop without cleanup; CI environments sharing one account and accumulating workspaces; multi-tenant apps provisioning a workspace per customer on a single admin account.","solutions":["Delete unused workspaces for the account until the count is below the limit, then retry.","Use a different account (account_id) that is under the 10-workspace cap.","If the limit is too low for your deployment, raise MAX_WORKSPACE_PER_ACCOUNT in WorkspaceServiceImpl or make it configurable."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// Java\nlong count = workspaceService.getWorkspaceCount(accountId);\nif (count >= 10) {\n    throw new IllegalStateException(\"Account \" + accountId + \" reached the 10-workspace limit\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    workspaceService.createWorkspace(workspace);\n} catch (BizException e) {\n    if (e.getMessage().contains(\"more than\")) {\n        // surface quota UI / offer cleanup of old workspaces\n    }\n}","preventionTips":["Check workspace count for the account before provisioning a new one.","Implement workspace cleanup in test/CI teardown.","Avoid provisioning one workspace per customer on a single shared account."],"tags":["quota","limit-exceeded","workspace"],"backgroundTag":"value-out-of-range","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}