pot-app/pot-desktop · error · Error

Can not find qrCodeUrl: ${JSON.stringify(result)}

Error message

Can not find qrCodeUrl: ${JSON.stringify(result)}

What it means

The aliyun `qrcode` function starts the OAuth device-login flow by POSTing to https://openapi.alipan.com/oauth/authorize/qrcode. If the response is 2xx but lacks `qrCodeUrl` and/or `sid`, the login QR cannot be displayed, so this error is thrown with the full body. It guards against Aliyun returning an unexpected success payload.

Source

Thrown at src/window/Config/pages/Backup/utils/aliyun.jsx:108

            throw new Error(`Get accessToken Error: ${JSON.stringify(result)}`);
        }
    }
}

export async function qrcode() {
    const res = await fetch('https://openapi.alipan.com/oauth/authorize/qrcode', {
        method: 'POST',
        body: Body.json({
            client_id: 'bf56dd2dc03a4d3489e3dda05dd6d466',
            scopes: ['user:base', 'file:all:read', 'file:all:write'],
        }),
    });
    if (res.ok) {
        const result = res.data;
        if (result['qrCodeUrl'] && result['sid']) {
            return { url: result['qrCodeUrl'], sid: result['sid'] };
        } else {
            throw new Error(`Can not find qrCodeUrl: ${JSON.stringify(result)}`);
        }
    } else {
        const result = res.data;
        if (result['message']) {
            throw new Error(result['message']);
        } else {
            throw new Error(`Get QrCode Error: ${JSON.stringify(result)}`);
        }
    }
}

export async function status(sid) {
    const res = await fetch(`https://openapi.alipan.com/oauth/qrcode/${sid}/status`);

    if (res.ok) {
        const result = res.data;
        if (result['status']) {
            return { status: result['status'], code: result['authCode'] };

View on GitHub (pinned to 594d32ede9)

Solutions

  1. Inspect the serialized body for an embedded error code explaining why the QR was not issued.
  2. Wait and retry if rate-limited — QR generation is throttled per client.
  3. If the client_id was revoked, update it in src/window/Config/pages/Backup/utils/aliyun.jsx (or the app needs an update with a new app registration).
  4. Check pot-app issue trackers — a revoked client_id affects all users and is fixed in releases.
Defensive patterns

Strategy: retry

Validate before calling

if (!navigator.onLine) {
  throw new Error('offline: cannot start alipan QR login');
}
// throttle user-triggered login attempts:
const canStartLogin = (lastAttempt) => Date.now() - lastAttempt > 10_000;

Type guard

function isQrCodeResult(data) {
  return data != null && typeof data === 'object' && typeof data['qrCodeUrl'] === 'string' && typeof data['sid'] === 'string';
}

Try / catch

try {
  const { url, sid } = await qrcode();
} catch (e) {
  if (String(e.message).startsWith('Can not find qrCodeUrl')) {
    showLoginUnavailableMessage(); // client_id revoked or throttled; suggest app update
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling qrcode() where the authorize/qrcode endpoint responds 200 but without the expected qrCodeUrl/sid fields — e.g. the client_id (bf56dd2dc03a4d3489e3dda05dd6d466) is revoked/disabled, rate-limited QR generation, or an Aliyun API schema change.

Common situations: Aliyun disabled or rotated the embedded app's client_id, the user triggers login repeatedly and hits QR-generation rate limits, or the alipan OAuth API changes its response field names.

Related errors


AI-assisted analysis of pot-app/pot-desktop@594d32ede9 (2026-09-02). Data as JSON: /api/errors/39507384aad2010b. Report an issue: GitHub.