toeverything/AFFiNE · error · Error

Invalid open-app sign-in payload

Error message

Invalid open-app sign-in payload

What it means

Thrown in the open-app-signin branch of the desktop auth-request handler when the payload lacks a string code, meaning the app was launched with a malformed sign-in token; OAuth sign-in via deep link cannot complete.

Source

Thrown at packages/frontend/core/src/modules/desktop-api/service/desktop-api.ts:152

          throw new Error('AFFiNE Cloud server not found');
        }
        const authService = targetServer.scope.get(AuthService);

        switch (method) {
          case 'magic-link': {
            const { email, token } = payload;
            await authService.signInMagicLink(email, token);
            break;
          }
          case 'oauth': {
            const { code, state, provider } = payload;
            await authService.signInOauth(code, state, provider);
            break;
          }
          case 'open-app-signin': {
            const code = (payload as { code?: unknown }).code;
            if (typeof code !== 'string' || !code) {
              throw new Error('Invalid open-app sign-in payload');
            }
            await authService.signInOpenAppSignInCode(code);
            break;
          }
        }
      })().catch(e => {
        notify.error({
          title: I18n['com.affine.auth.toast.title.failed'](),
          message: (e as any).message,
        });
      });
    });
  }
}

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Restart the sign-in flow from the web page to generate a fresh payload.
  2. Do not modify the sign-in deep link.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown in the open-app-signin branch of the desktop auth handler when the payload's code field is missing or not a non-empty string, so the sign-in code exchange cannot proceed.

Common situations: Triggered by a malformed or outdated sign-in deep link opened in the desktop app that lacks a valid code parameter. Restart the sign-in flow from the browser to get a fresh link.


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