nexu-io/open-design · warning · AutomationWorkspaceScopeError

WORKSPACE_AUTHORITY_UNAVAILABLE

WORKSPACE_AUTHORITY_UNAVAILABLE

Error message

workspace membership authority is not configured

What it means

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.

Source

Thrown at apps/daemon/src/automations/workspace-scope.ts:86

    projectId,
    workspaceId: scope.workspaceId,
    visibility: 'personal',
    resourceState: 'active',
    createdByWorkspaceMemberId: scope.workspaceMemberId,
    updatedByWorkspaceMemberId: scope.workspaceMemberId,
    syncState: 'local_only',
    resourceHubResourceId: null,
    cloudTombstonedAt: null,
    createdAt: now,
    updatedAt: now,
  });
}

async function fetchDirectoryOrThrow(
  fetchWorkspaceDirectory: (() => Promise<WorkspaceDirectoryFetchResult>) | undefined,
): Promise<WorkspaceDirectoryItem[]> {
  if (!fetchWorkspaceDirectory) {
    throw new AutomationWorkspaceScopeError(
      'WORKSPACE_AUTHORITY_UNAVAILABLE',
      'workspace membership authority is not configured',
      true,
    );
  }
  let directory: WorkspaceDirectoryFetchResult;
  try {
    directory = await fetchWorkspaceDirectory();
  } catch {
    directory = { ok: false, items: [] };
  }
  if (!directory.ok) {
    throw new AutomationWorkspaceScopeError(
      'WORKSPACE_AUTHORITY_UNAVAILABLE',
      'workspace membership authority is temporarily unavailable',
      true,
    );
  }

View on GitHub (pinned to 5be4028344)

Solutions

  1. Sign in to the Workspace authority so server.ts populates workspaceDirectoryAuthority.read.
  2. If you are calling these functions directly, pass a non-undefined fetchWorkspaceDirectory argument.
  3. Avoid persisting Workspace-scoped automations when running in local-only mode; use local scope instead.

Example fix

// before: caller passes undefined because no authority is signed in
await authorizePersistedAutomationWorkspaceScope(scope, undefined);

// after: sign in (or pass the daemon-provided authority)
await authorizePersistedAutomationWorkspaceScope(scope, workspaceDirectoryAuthority.read);
Defensive patterns

Strategy: validation

Validate before calling

function assertWorkspaceAuthority(fetcher: unknown): asserts fetcher is () => Promise<{ ok: boolean; items: unknown[] }> {
  if (typeof fetcher !== 'function') {
    throw new Error('Workspace authority is not configured. Sign in to a Workspace before using Workspace-scoped automations.');
  }
}
assertWorkspaceAuthority(fetchWorkspaceDirectory);

Type guard

function isWorkspaceAuthorityConfigured(fetcher: unknown): fetcher is () => Promise<{ ok: boolean; items: unknown[] }> {
  return typeof fetcher === 'function';
}

Try / catch

try {
  await authorizePersistedAutomationWorkspaceScope(scope, fetcher);
} catch (err) {
  if (err instanceof AutomationWorkspaceScopeError && err.code === 'WORKSPACE_AUTHORITY_UNAVAILABLE' && !wasReachable) {
    // config missing: prompt sign-in, do NOT retry in a tight loop
    return serviceUnavailable('Sign in to a Workspace to use Workspace-scoped automations.');
  }
  throw err;
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/fa9474e7081bea6b. Report an issue: GitHub.