{"record":{"id":"140ee26065efc72b","repo":"toeverything/AFFiNE","slug":"no-server","errorCode":null,"errorMessage":"No Server","messagePattern":"No Server","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/permissions/stores/doc-granted-users.ts","lineNumber":61,"sourceCode":"      )\n      .then(data => ({\n        ...data,\n        edges: data.edges.map(edge => ({\n          node: mapDocGrantedUserSnapshot(edge.node),\n        })),\n      }));\n  }\n\n  subscribeDocGrants(workspaceId: string, docId: string) {\n    return this.nbstoreService.realtime.subscribe('doc.grants.changed', {\n      workspaceId,\n      docId,\n    });\n  }\n\n  async grantDocUserRoles(input: GrantDocUserRolesInput) {\n    if (!this.workspaceServerService.server) {\n      throw new Error('No Server');\n    }\n    const res = await this.workspaceServerService.server.gql({\n      query: grantDocUserRolesMutation,\n      variables: {\n        input,\n      },\n    });\n\n    return res.grantDocUserRoles;\n  }\n\n  async revokeDocUserRoles(workspaceId: string, docId: string, userId: string) {\n    if (!this.workspaceServerService.server) {\n      throw new Error('No Server');\n    }\n    const res = await this.workspaceServerService.server.gql({\n      query: revokeDocUserRolesMutation,\n      variables: {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/permissions/stores/doc-granted-users.ts#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Connect to a server before managing granted users.","Select a workspace with an associated server."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}