{"record":{"id":"156b80ef5fa981de","repo":"toeverything/AFFiNE","slug":"affine-cloud-server-not-found","errorCode":null,"errorMessage":"AFFiNE Cloud server not found","messagePattern":"AFFiNE Cloud server not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/desktop-api/service/desktop-api.ts","lineNumber":134,"sourceCode":"  private setupAuthRequestEvent() {\n    this.events.ui.onAuthenticationRequest(({ method, payload, server }) => {\n      (async () => {\n        if (!(await this.api.handler.ui.isActiveTab())) {\n          return;\n        }\n\n        // Dynamically get these services to avoid circular dependencies\n        const serversService = this.framework.get(ServersService);\n        const defaultServerService = this.framework.get(DefaultServerService);\n\n        let targetServer;\n        if (server) {\n          targetServer = await serversService.addOrGetServerByBaseUrl(server);\n        } else {\n          targetServer = defaultServerService.server;\n        }\n        if (!targetServer) {\n          throw new Error('AFFiNE Cloud server not found');\n        }\n        const authService = targetServer.scope.get(AuthService);\n\n        switch (method) {\n          case 'magic-link': {\n            const { email, token } = payload;\n            await authService.signInMagicLink(email, token);\n            break;\n          }\n          case 'oauth': {\n            const { code, state, provider } = payload;\n            await authService.signInOauth(code, state, provider);\n            break;\n          }\n          case 'open-app-signin': {\n            const code = (payload as { code?: unknown }).code;\n            if (typeof code !== 'string' || !code) {\n              throw new Error('Invalid open-app sign-in payload');","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/desktop-api/service/desktop-api.ts#L116-L152","documentation":"In the desktop auth-request event handler, thrown when an authentication request names a server (by base URL) that is not present in the servers registry and the AFFiNE Cloud default also cannot be resolved, so sign-in cannot proceed for that server.","triggerScenarios":"Thrown in the desktop authentication request handler when neither a server for the requested base URL nor the default server can be resolved (addOrGetServerByBaseUrl and defaultServerService.server both yield nothing) before signing in via magic-link, oauth, or open-app-signin.","commonSituations":"Sign-in from the desktop app fails because no AFFiNE Cloud server is configured or reachable for the auth redirect. Check the server URL settings and network connectivity, then retry the sign-in.","solutions":["Add the AFFiNE Cloud server to the server list first.","Check the server configuration and sign in again."],"exampleFix":null,"handlingStrategy":"fallback","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-14T05:17:10.506Z"}