hcengineering/platform · error · PlatformError
WorkspaceLimitReached
WorkspaceLimitReached
Error message
created-by-limit
What it means
createWorkspace enforces a per-user workspace quota: the number of workspaces created by the person (maxWorkspaces on the account, falling back to workspaceLimitPerUser) must not be exceeded. Exceeding it throws WorkspaceLimitReached with the workspace name.
Source
Thrown at server/account/src/operations.ts:602
if (socialId == null) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.AccountNotConfirmed, {}))
}
const person = await db.person.findOne({ uuid: socialId.personUuid })
if (person == null) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.InternalServerError, {}))
}
const accountObj = await db.account.findOne({ uuid: account })
if (accountObj == null) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.InternalServerError, {}))
}
// Get a list of created workspaces
const created = (await db.workspace.find({ createdBy: socialId.personUuid })).length
if (created >= (accountObj.maxWorkspaces ?? workspaceLimitPerUser)) {
ctx.warn('created-by-limit', { person: socialId.key, workspace: workspaceName })
throw new PlatformError(
new Status(Severity.ERROR, platform.status.WorkspaceLimitReached, { workspace: workspaceName })
)
}
// Persist the client-provided configuration as-is. The only currently
// supported field is `withDemoContent`; future fields can be added without
// changing the wire shape.
const pendingConfiguration =
configuration?.withDemoContent !== undefined ? { withDemoContent: configuration.withDemoContent } : undefined
const { workspaceUuid, workspaceUrl } = await createWorkspaceRecord(
ctx,
db,
branding,
workspaceName,
account,
region,View on GitHub (pinned to 63e28dc964)
Solutions
- Delete unused workspaces created by the user to get under the limit.
- Ask an admin to raise maxWorkspaces on the account.
- In automation, check the count of created workspaces before calling createWorkspace and stop at the quota.
- Catch WorkspaceLimitReached in the UI and present an upgrade request path.
Example fix
// before const ws = await client.createWorkspace(workspaceName) // throws at limit // after const mine = await getWorkspacesCreatedBy(me) const limit = account.maxWorkspaces ?? DEFAULT_LIMIT if (mine.length >= limit) throw new UpgradeRequiredError() const ws = await client.createWorkspace(workspaceName)
Defensive patterns
Strategy: validation
Validate before calling
const created = await getWorkspacesCreatedBy(personUuid) const limit = account.maxWorkspaces ?? DEFAULT_WORKSPACE_LIMIT if (created.length >= limit) throw new WorkspaceLimitError(limit)
Type guard
function isWorkspaceLimitReached(e: unknown): boolean {
return e instanceof PlatformError && e.status.code === platform.status.WorkspaceLimitReached
} Try / catch
try {
await client.createWorkspace(name)
} catch (e) {
if (isWorkspaceLimitReached(e)) {
promptUpgrade()
return
}
throw e
} Prevention
- Cache the current workspace count and check it before creating new workspaces.
- Cap automated/test workspace creation loops.
- Catch WorkspaceLimitReached in UIs and offer an upgrade path.
When it happens
Trigger: Calling createWorkspace when the requesting person already created >= maxWorkspaces (or the default workspaceLimitPerUser) workspaces, counted via db.workspace.find({ createdBy: personUuid }).
Common situations: Free-tier users hitting the workspace cap; test scripts creating many workspaces in a loop; an admin lowering maxWorkspaces below the user's current count; automated provisioning exceeding quota.
Related errors
- Workspace ${options.workspace} not found
- Workspace not found
- Workspace not found
- Workspace is closing
- Current workspace not found
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/5296868a903766c6.
Report an issue: GitHub.