alibaba/spring-ai-alibaba · error · BizException

INVALID_REQUEST

INVALID_REQUEST

Error message

workspace can not be more than 10.

What it means

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).

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/WorkspaceServiceImpl.java:91

	 * @param workspace Workspace information
	 * @return ID of the created workspace
	 */
	@Override
	public String createWorkspace(Workspace workspace) {
		if (StringUtils.isBlank(workspace.getAccountId())) {
			RequestContext context = RequestContextHolder.getRequestContext();
			workspace.setAccountId(context.getAccountId());
		}

		// check if workspace name exists
		WorkspaceEntity entity = getWorkspaceByName(workspace.getAccountId(), workspace.getName());
		if (entity != null) {
			throw new BizException(ErrorCode.WORKSPACE_NAME_EXISTS.toError());
		}

		long workspaceCount = getWorkspaceCount(workspace.getAccountId());
		if (workspaceCount > MAX_WORKSPACE_PER_ACCOUNT) {
			throw new BizException(ErrorCode.INVALID_REQUEST
				.toError("workspace can not be more than " + MAX_WORKSPACE_PER_ACCOUNT + "."));
		}

		String workspaceId = IdGenerator.idStr();
		entity = BeanCopierUtils.copy(workspace, WorkspaceEntity.class);
		entity.setWorkspaceId(workspaceId);
		entity.setAccountId(workspace.getAccountId());
		entity.setGmtCreate(new Date());
		entity.setGmtModified(new Date());
		entity.setCreator(workspace.getAccountId());
		entity.setModifier(workspace.getAccountId());

		this.save(entity);

		// cache it
		String key = getWorkspaceCacheKey(workspace.getAccountId(), entity.getWorkspaceId());
		redisManager.put(key, entity);

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Delete unused workspaces for the account until the count is below the limit, then retry.
  2. Use a different account (account_id) that is under the 10-workspace cap.
  3. If the limit is too low for your deployment, raise MAX_WORKSPACE_PER_ACCOUNT in WorkspaceServiceImpl or make it configurable.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

// Java
long count = workspaceService.getWorkspaceCount(accountId);
if (count >= 10) {
    throw new IllegalStateException("Account " + accountId + " reached the 10-workspace limit");
}

Try / catch

try {
    workspaceService.createWorkspace(workspace);
} catch (BizException e) {
    if (e.getMessage().contains("more than")) {
        // surface quota UI / offer cleanup of old workspaces
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/4d0c1c7c6713d2b7. Report an issue: GitHub.