hcengineering/platform · error
Unknown workspace
Error message
Unknown workspace
What it means
getWorkspaceUuid validates the :workspace route parameter with uuidValidate; if it is not a valid UUID it throws Error('Unknown workspace'). Any non-UUID workspace path segment is rejected as an unidentifiable workspace.
Source
Thrown at services/billing/pod-billing/src/billing.ts:199
for (const storageConfig of storageConfigs) {
if (storageConfig.kind !== 'datalake') {
continue
}
const storageStats = await client.getWorkspaceStats(ctx, workspace)
result.count += storageStats.count
result.size += storageStats.size
}
return result
}
function getWorkspaceUuid (req: Request): WorkspaceUuid {
const { workspace } = req.params
if (uuidValidate(workspace)) {
return workspace as WorkspaceUuid
}
throw new Error('Unknown workspace')
}
function parseDateParameters (req: Request): { fromDate: Date, toDate: Date } {
let fromDate: Date
if (typeof req.query.fromDate === 'string') {
fromDate = new Date(Date.parse(req.query.fromDate))
} else {
fromDate = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
}
let toDate: Date
if (typeof req.query.toDate === 'string') {
toDate = new Date(Date.parse(req.query.toDate))
} else {
toDate = new Date(Date.now())
}
return { fromDate, toDate }View on GitHub (pinned to 63e28dc964)
Solutions
- Pass the workspace UUID (as returned by the workspace API) in the URL, not its name/slug
- Look up the UUID from a name via the workspaces listing endpoint before calling billing routes
- Validate the param client-side with a UUID regex/validator before building the URL
- Check for truncation or encoding corruption of the ID in logs
Example fix
// before
fetch(`/workspaces/${workspaceName}/billing`)
// after
if (uuidValidate(workspaceUuid)) {
fetch(`/workspaces/${workspaceUuid}/billing`)
} Defensive patterns
Strategy: validation
Validate before calling
import { validate as uuidValidate } from 'uuid'
if (!uuidValidate(workspaceUuid)) {
throw new Error(`'${workspaceUuid}' is not a valid workspace UUID`)
} Type guard
function isWorkspaceUuid(v: unknown): v is WorkspaceUuid {
return typeof v === 'string' && uuidValidate(v)
} Try / catch
try {
await billing.get(`/workspaces/${workspaceUuid}/...`)
} catch (err) {
if (String(err.response?.data ?? err.message).includes('Unknown workspace')) {
// re-resolve the workspace UUID by name before retrying
} else throw err
} Prevention
- Store and pass workspace UUIDs, never names or slugs
- Validate UUID format in client code before building URLs
- Resolve name-to-UUID via the workspace API once and cache it
When it happens
Trigger: Request to any billing workspace route with a workspace param that is a slug, name, empty string, or otherwise not a valid UUID (e.g. GET /workspaces/my-team/billing).
Common situations: Client uses human-readable workspace names instead of UUIDs; truncated or copy-paste-damaged UUID; URL-encoding issues; old links using legacy identifiers.
Related errors
- Invalid account uuid: "${accountUuid}"
- Invalid workspace uuid: "${workspaceUuid}"
- Invalid grant workspace uuid: "${grant?.workspace}"
- Container ${target} not found
- No gmail clients found for social id
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/b1839d03c4e3cb10.
Report an issue: GitHub.