pot-app/pot-desktop · error · Error

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

Error message

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

What it means

The status() helper polls https://openapi.alipan.com/oauth/qrcode/{sid}/status while the user scans the login QR code. If the response is HTTP-ok but the body has no `status` field, the code throws `Can not find status: <body JSON>`. It indicates the API returned 200 with an unexpected payload shape.

Source

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

    } 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']);
        } else {
            throw new Error(`Get Status Error: ${JSON.stringify(result)}`);
        }
    }
}

export async function userInfo(token) {
    const res = await fetch('https://openapi.alipan.com/oauth/users/info', {
        headers: {
            Authorization: `Bearer ${token}`,
        },
    });
    if (res.ok) {

View on GitHub (pinned to 594d32ede9)

Solutions

  1. Log the JSON in the error to see what the endpoint actually returned.
  2. Re-run qrcode() to obtain a fresh sid and restart the login flow when the session is expired.
  3. Treat this as 'session expired/invalid' in the polling loop and stop polling instead of crashing.
  4. Check for Alipan OAuth API schema changes and update field expectations.

Example fix

// before
if (result['status']) {
    return { status: result['status'], code: result['authCode'] };
} else {
    throw new Error(`Can not find status: ${JSON.stringify(result)}`);
}
// after
if (result && typeof result.status === 'string') {
    return { status: result.status, code: result.authCode };
}
return { status: 'expired' }; // treat missing status as expired session, refresh sid via qrcode()
Defensive patterns

Strategy: validation

Validate before calling

// validate the poll result before trusting it
function hasStatus(data) {
  return data && typeof data === 'object' && typeof data.status === 'string' && data.status.length > 0;
}
// use: if (hasStatus(res.data)) { ... } else { regenerate sid via qrcode() }

Type guard

function isQrStatusResponse(r) {
  return r && typeof r === 'object' && typeof r.status === 'string';
}

Try / catch

try {
  const { status, code } = await status(sid);
  if (status === 'LoginSuccess') finishLogin(code);
} catch (e) {
  if (String(e.message).startsWith('Can not find status')) {
    // missing status field = expired/invalid session — stop polling, get new QR
    stopPolling();
    restartQrLogin();
  }
}

Prevention

When it happens

Trigger: Calling status(sid) with an HTTP 200 response whose res.data lacks `status` — e.g. an expired/invalid sid returning an empty or error-shaped object, or the endpoint's response schema changing.

Common situations: Polling with a stale sid after the QR session expired; the QR session was consumed/cancelled and the API returns a 200 with no status; a version change of the Alipan OAuth API that renamed the `status` field.

Related errors


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