toeverything/AFFiNE · error · Error

Invalid Hashcash challenge

Error message

Invalid Hashcash challenge

What it means

Thrown in CaptchaService's revalidate effect when the captcha endpoint returns a non-hashcash provider or hashcash without challenge/resource, or no validator provider is registered locally — a hashcash challenge cannot be computed for the next auth request.

Source

Thrown at packages/frontend/core/src/modules/cloud/services/captcha.ts:68

          siteKey?: string;
          action?: string;
        };
        if (data.provider === 'turnstile') {
          if (!data.siteKey || !data.action) {
            throw new Error('Invalid Turnstile configuration');
          }
          return {
            provider: data.provider,
            turnstile: { siteKey: data.siteKey, action: data.action },
          };
        }
        if (
          data.provider !== 'hashcash' ||
          !data.challenge ||
          !data.resource ||
          !this.validatorProvider
        ) {
          throw new Error('Invalid Hashcash challenge');
        }
        const token = await this.validatorProvider.validate(
          data.challenge,
          data.resource
        );
        return {
          provider: data.provider,
          token,
          challenge: data.challenge,
        };
      }).pipe(
        tap(({ challenge, provider, token, turnstile }) => {
          this.provider$.next(provider);
          this.turnstile$.next(turnstile);
          this.verifyToken$.next(token);
          this.challenge$.next(challenge);
          if (token) this.resetAfter5min();
        }),

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Request a fresh Hashcash challenge and retry.
  2. Ensure the challenge payload is passed unmodified to the solver.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown in the captcha service when the provider is not hashcash, or the challenge/resource fields are missing, or no hashcash validatorProvider is registered.

Common situations: Appears when captcha validation cannot run, e.g. bad server challenge response or missing validator on the client. Retry sign-in; check server captcha setup.


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