toeverything/AFFiNE · error · Error

No server

Error message

No server

What it means

getDocPermissions queries permission actions from the cloud server; when workspaceServerService.server is missing (no server bound to this workspace) it throws Error('No server') instead of issuing the request.

Source

Thrown at packages/frontend/core/src/modules/permissions/stores/guard.ts:42

    super();
  }

  async getWorkspacePermissions(): Promise<
    Record<WorkspacePermissionActions, boolean>
  > {
    const { access } = await this.nbstoreService.realtime.request(
      'workspace.access.get',
      { workspaceId: this.workspaceService.workspace.id },
      { timeoutMs: 10000 }
    );
    return access.permissions as Record<WorkspacePermissionActions, boolean>;
  }

  async getDocPermissions(
    docId: string
  ): Promise<Record<DocPermissionActions, boolean>> {
    if (!this.workspaceServerService.server) {
      throw new Error('No server');
    }
    const data = await this.workspaceServerService.server.gql({
      query: getDocRolePermissionsQuery,
      variables: {
        workspaceId: this.workspaceService.workspace.id,
        docId,
      },
    });
    return data.workspace.doc.permissions;
  }
}

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Connect to a server before performing permission checks.
  2. Ensure the workspace has a server configured.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown by getDocPermissions in the guard store when workspaceServerService.server is null, preventing the doc role permissions GraphQL query from running.

Common situations: Doc permission checks fail for a workspace without an active cloud server connection. Ensure the workspace is connected to a server and the user is signed in.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/fc430044c200aec0. Report an issue: GitHub.