pot-app/pot-desktop · error · Error
Get QrCode Error: ${JSON.stringify(result)}
Error message
Get QrCode Error: ${JSON.stringify(result)} What it means
The aliyun.jsx qrcode() helper requests a login QR code from Alipan's OAuth endpoint (https://openapi.alipan.com/oauth/authorize/qrcode). When the HTTP response is not ok and the error body contains no `message` field, the code falls back to throwing `Get QrCode Error: <raw body JSON>`. It means the QR-code request failed with an unexpected response shape (no usable error message returned by the API).
Source
Thrown at src/window/Config/pages/Backup/utils/aliyun.jsx:115
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'] };
} else {
throw new Error(`Can not find status: ${JSON.stringify(result)}`);
}
} else {
const result = res.data;
if (result['message']) {
throw new Error(result['message']);View on GitHub (pinned to 594d32ede9)
Solutions
- Retry the QR-code request; transient gateway errors usually resolve on retry.
- Inspect the JSON in the error message to identify the actual failure (status code, blocked request, etc.).
- Check network/proxy settings — the Tauri HTTP client must be able to reach openapi.alipan.com.
- Verify the Alipan OAuth API still returns errors with a `message` field; update the parser if the API contract changed.
Example fix
// before
throw new Error(`Get QrCode Error: ${JSON.stringify(result)}`);
// after
if (res.status === 429 || res.status >= 500) {
// retry with backoff before giving up
return retryQrcode();
}
throw new Error(`Get QrCode Error (HTTP ${res.status}): ${JSON.stringify(result)}`); Defensive patterns
Strategy: try-catch
Validate before calling
// before calling qrcode(), verify connectivity to the API
const reachable = await fetch('https://openapi.alipan.com').then(r => true).catch(() => false);
if (!reachable) throw new Error('openapi.alipan.com unreachable — check network/proxy'); Type guard
function isQrCodeResponse(r) {
return r && typeof r === 'object' && typeof r.qrCodeUrl === 'string' && typeof r.sid === 'string';
} Try / catch
try {
const { url, sid } = await qrcode();
showQr(url);
} catch (e) {
if (String(e.message).startsWith('Get QrCode Error')) {
// non-2xx without API message: transient/gateway — retry with backoff
await sleep(2000);
retryQrcode();
} else {
showError(e.message);
}
} Prevention
- Retry QR-code requests with exponential backoff before surfacing the error
- Check network/proxy reachability of openapi.alipan.com on app startup
- Log the stringified body plus HTTP status for diagnosis
- Keep the client_id/scope payload in sync with the current Alipan OAuth API contract
When it happens
Trigger: Calling qrcode() and the POST to openapi.alipan.com/oauth/authorize/qrcode returns a non-2xx status whose res.data lacks a `message` key (e.g. HTML error page, empty body, proxy/gateway error JSON with different field names).
Common situations: Alipan API downtime or rate limiting returning an HTML/CDN error page; a corporate proxy or firewall intercepting the request; the hardcoded client_id being revoked or the API contract changing; DNS/network failure inside the Tauri HTTP client producing an opaque error payload.
Related errors
- Get Status Error: ${JSON.stringify(result)}
- Get UserInfo Error: ${JSON.stringify(result)}
- Can not find status: ${JSON.stringify(result)}
- Can not find avatar or name: ${JSON.stringify(result)}
- Can not find access_token: ${JSON.stringify(result)}
AI-assisted analysis of pot-app/pot-desktop@594d32ede9 (2026-09-02).
Data as JSON: /api/errors/8aa29ddb2fa0c283.
Report an issue: GitHub.