{"record":{"id":"fa9474e7081bea6b","repo":"nexu-io/open-design","slug":"workspace-authority-unavailable","errorCode":"WORKSPACE_AUTHORITY_UNAVAILABLE","errorMessage":"workspace membership authority is not configured","messagePattern":"workspace membership authority is not configured","errorType":"error_code","errorClass":"AutomationWorkspaceScopeError","httpStatus":null,"severity":"warning","filePath":"apps/daemon/src/automations/workspace-scope.ts","lineNumber":86,"sourceCode":"    projectId,\n    workspaceId: scope.workspaceId,\n    visibility: 'personal',\n    resourceState: 'active',\n    createdByWorkspaceMemberId: scope.workspaceMemberId,\n    updatedByWorkspaceMemberId: scope.workspaceMemberId,\n    syncState: 'local_only',\n    resourceHubResourceId: null,\n    cloudTombstonedAt: null,\n    createdAt: now,\n    updatedAt: now,\n  });\n}\n\nasync function fetchDirectoryOrThrow(\n  fetchWorkspaceDirectory: (() => Promise<WorkspaceDirectoryFetchResult>) | undefined,\n): Promise<WorkspaceDirectoryItem[]> {\n  if (!fetchWorkspaceDirectory) {\n    throw new AutomationWorkspaceScopeError(\n      'WORKSPACE_AUTHORITY_UNAVAILABLE',\n      'workspace membership authority is not configured',\n      true,\n    );\n  }\n  let directory: WorkspaceDirectoryFetchResult;\n  try {\n    directory = await fetchWorkspaceDirectory();\n  } catch {\n    directory = { ok: false, items: [] };\n  }\n  if (!directory.ok) {\n    throw new AutomationWorkspaceScopeError(\n      'WORKSPACE_AUTHORITY_UNAVAILABLE',\n      'workspace membership authority is temporarily unavailable',\n      true,\n    );\n  }","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/automations/workspace-scope.ts#L68-L104","documentation":"Thrown by fetchDirectoryOrThrow as an AutomationWorkspaceScopeError with code WORKSPACE_AUTHORITY_UNAVAILABLE and retryable=true. It fires when the caller passed undefined for fetchWorkspaceDirectory, meaning the daemon has no Workspace membership authority wired into this code path. Distinct from error 26: this is a missing-config problem, not a transient failure.","triggerScenarios":"Invoking authorizePersistedAutomationWorkspaceScope or authorizePersistedProjectWorkspace from a request context where server.ts did not supply a fetchWorkspaceDirectory callback (e.g. single-user local mode, or the Workspace collab feature is disabled).","commonSituations":"Running the daemon in local-only mode without signing in to a Workspace; a deployment where the vela/Workspace authority was never registered; calling a Workspace-scoped automation API before login.","solutions":["Sign in to the Workspace authority so server.ts populates workspaceDirectoryAuthority.read.","If you are calling these functions directly, pass a non-undefined fetchWorkspaceDirectory argument.","Avoid persisting Workspace-scoped automations when running in local-only mode; use local scope instead."],"exampleFix":"// before: caller passes undefined because no authority is signed in\nawait authorizePersistedAutomationWorkspaceScope(scope, undefined);\n\n// after: sign in (or pass the daemon-provided authority)\nawait authorizePersistedAutomationWorkspaceScope(scope, workspaceDirectoryAuthority.read);","handlingStrategy":"validation","validationCode":"function assertWorkspaceAuthority(fetcher: unknown): asserts fetcher is () => Promise<{ ok: boolean; items: unknown[] }> {\n  if (typeof fetcher !== 'function') {\n    throw new Error('Workspace authority is not configured. Sign in to a Workspace before using Workspace-scoped automations.');\n  }\n}\nassertWorkspaceAuthority(fetchWorkspaceDirectory);","typeGuard":"function isWorkspaceAuthorityConfigured(fetcher: unknown): fetcher is () => Promise<{ ok: boolean; items: unknown[] }> {\n  return typeof fetcher === 'function';\n}","tryCatchPattern":"try {\n  await authorizePersistedAutomationWorkspaceScope(scope, fetcher);\n} catch (err) {\n  if (err instanceof AutomationWorkspaceScopeError && err.code === 'WORKSPACE_AUTHORITY_UNAVAILABLE' && !wasReachable) {\n    // config missing: prompt sign-in, do NOT retry in a tight loop\n    return serviceUnavailable('Sign in to a Workspace to use Workspace-scoped automations.');\n  }\n  throw err;\n}","preventionTips":["Sign in to the Workspace authority at daemon startup so server.ts populates workspaceDirectoryAuthority.read.","Detect local-only mode and avoid persisting Workspace-scoped automations there.","Surface a clear 'sign in required' message rather than retrying when the fetcher is undefined."],"tags":["workspace","auth","config","automation","retryable"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}