{"record":{"id":"27e93357f155c484","repo":"nexu-io/open-design","slug":"billing-workspace-snapshot-unsupported","errorCode":"billing_workspace_snapshot_unsupported","errorMessage":"workspace billing snapshot unsupported","messagePattern":"workspace billing snapshot unsupported","errorType":"exception","errorClass":"VelaWorkspaceBillingSnapshotUnsupportedError","httpStatus":null,"severity":"warning","filePath":"apps/daemon/src/integrations/vela-billing.ts","lineNumber":523,"sourceCode":"    : null;\n}\n\nconst defaultRunVelaBilling: RunVelaBilling = async (args) => {\n  let stderr = '';\n  try {\n    return await runVelaCommand(['billing', ...args], {\n      configuredEnv: { VELA_INVOCATION_SOURCE: 'open-design' },\n      maxBuffer: 4 * 1024 * 1024,\n      onStderr: (value) => {\n        stderr = value;\n      },\n    });\n  } catch (error) {\n    if (\n      args[0] === 'workspace-snapshot' &&\n      isWorkspaceBillingSnapshotUnsupported(error, stderr)\n    ) {\n      throw new VelaWorkspaceBillingSnapshotUnsupportedError();\n    }\n    throw error;\n  }\n};\n\nfunction isWorkspaceBillingSnapshotUnsupported(error: unknown, stderr: string): boolean {\n  const detail = [\n    stderr,\n    error instanceof Error ? error.message : String(error),\n  ].join('\\n').toLowerCase();\n  return (\n    detail.includes('billing_workspace_snapshot_unsupported') ||\n    detail.includes('workspace billing snapshot unsupported') ||\n    detail.includes('unknown flag: --workspace-id') ||\n    (\n      detail.includes('unknown command') &&\n      detail.includes('workspace-snapshot')\n    )","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/integrations/vela-billing.ts#L505-L541","documentation":"A sentinel error (VelaWorkspaceBillingSnapshotUnsupportedError, code billing_workspace_snapshot_unsupported) raised by the default runner when the vela CLI does not support the workspace-snapshot subcommand. It is designed to be caught by resolveVelaWorkspaceBillingProjection so it can fall back to the legacy workspace-balance command. Reaching it as an uncaught error means the fallback layer was bypassed or the caller invoked runVelaCommand directly.","triggerScenarios":"An older vela binary (no workspace-snapshot subcommand, unknown --workspace-id flag, or 'unknown command workspace-snapshot' in stderr). The detection logic in isWorkspaceBillingSnapshotUnsupported matches on those stderr substrings.","commonSituations":"Packaged/bundled vela binary is older than the daemon expects; PATH resolves a stale vela; user-downgraded vela; CI using an old vela mock. The error is expected — the system is built to fall back.","solutions":["Catch VelaWorkspaceBillingSnapshotUnsupportedError at the layer that owns fallback (as resolveVelaWorkspaceBillingProjection already does) and route to workspace-balance.","Upgrade the vela binary so workspace-snapshot is supported.","If calling runVelaCommand directly with workspace-snapshot, wrap it to translate the sentinel into the legacy path."],"exampleFix":"// before\nconst stdout = await runVelaCommand(['billing', 'workspace-snapshot', ...], ...);\n\n// after\ntry {\n  const stdout = await runVelaCommand(['billing', 'workspace-snapshot', ...], ...);\n  // ... parse snapshot\n} catch (err) {\n  if (err instanceof VelaWorkspaceBillingSnapshotUnsupportedError) {\n    return resolveVelaWorkspaceBillingProjection({ workspaceId, run });\n  }\n  throw err;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"import { VelaWorkspaceBillingSnapshotUnsupportedError } from '../integrations/vela-billing.js';\n\nfunction isSnapshotUnsupported(err: unknown): boolean {\n  return err instanceof VelaWorkspaceBillingSnapshotUnsupportedError;\n}","tryCatchPattern":"try {\n  return await runVelaCommand(['billing', 'workspace-snapshot', ...], opts);\n} catch (err) {\n  if (err instanceof VelaWorkspaceBillingSnapshotUnsupportedError) {\n    return await resolveVelaWorkspaceBillingProjection({ workspaceId, run });\n  }\n  throw err;\n}","preventionTips":["Always catch this sentinel at the layer that owns the legacy fallback.","Update vela so workspace-snapshot is supported to skip the fallback entirely.","Do not surface this error to end users — it is an internal version-compat signal."],"tags":["billing","integration","version-compat","vela"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}