toeverything/AFFiNE · error · Error

No Server

Error message

No Server

What it means

A precondition sentinel in grantDocUserRoles: every server-mutating method in this store requires an established workspace server connection, and this fires when workspaceServerService.server is null. It means the doc-permission grant was attempted while the workspace is local-only or the cloud session is not yet connected — not a server-side rejection; connect to a server before calling.

Source

Thrown at packages/frontend/core/src/modules/permissions/stores/doc-granted-users.ts:61

      )
      .then(data => ({
        ...data,
        edges: data.edges.map(edge => ({
          node: mapDocGrantedUserSnapshot(edge.node),
        })),
      }));
  }

  subscribeDocGrants(workspaceId: string, docId: string) {
    return this.nbstoreService.realtime.subscribe('doc.grants.changed', {
      workspaceId,
      docId,
    });
  }

  async grantDocUserRoles(input: GrantDocUserRolesInput) {
    if (!this.workspaceServerService.server) {
      throw new Error('No Server');
    }
    const res = await this.workspaceServerService.server.gql({
      query: grantDocUserRolesMutation,
      variables: {
        input,
      },
    });

    return res.grantDocUserRoles;
  }

  async revokeDocUserRoles(workspaceId: string, docId: string, userId: string) {
    if (!this.workspaceServerService.server) {
      throw new Error('No Server');
    }
    const res = await this.workspaceServerService.server.gql({
      query: revokeDocUserRolesMutation,
      variables: {

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Connect to a server before managing granted users.
  2. Select a workspace with an associated server.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown in doc-granted-users store mutations (grantDocUserRoles, revokeDocUserRoles) when workspaceServerService.server is null, i.e. the workspace has no connected cloud server to run the GraphQL mutation against.

Common situations: Sharing permissions on a doc cannot be changed because the workspace is local-only or the server connection dropped. Connect/sign in to the AFFiNE Cloud server and retry.


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