pot-app/pot-desktop · error · Error

Get accessToken Error: ${JSON.stringify(result)}

Error message

Get accessToken Error: ${JSON.stringify(result)}

What it means

In the aliyun backup `list` function, when the API returns a non-2xx status and the body has NO `message` field, the code falls back to this error (the label says accessToken but it is really 'the request failed with an unrecognizable error body'). It serializes the full body so the developer can diagnose the unexpected failure.

Source

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

            type: 'file',
            order_by: 'name',
        }),
    });
    if (res.ok) {
        const result = res.data;
        if (result['items']) {
            return result['items'].map((item) => {
                return item['name'];
            });
        } else {
            throw new Error(`Get File List Error: ${JSON.stringify(result)}`);
        }
    } else {
        const result = res.data;
        if (result['message']) {
            throw new Error(result['message']);
        } else {
            throw new Error(`Get accessToken Error: ${JSON.stringify(result)}`);
        }
    }
}

export async function get(token, name) {
    const drive_id = await driveId(token);
    const file_id = await getFileByPath(token, drive_id, name);
    const url = await getDownloadUrl(token, drive_id, file_id);
    await invoke('aliyun', { operate: 'get', path: '', url });
}

export async function remove(token, name) {
    const drive_id = await driveId(token);
    const file_id = await getFileByPath(token, drive_id, name);
    const res = await fetch('https://openapi.alipan.com/adrive/v1.0/openFile/delete', {
        method: 'POST',
        headers: {
            Authorization: `Bearer ${token}`,

View on GitHub (pinned to 594d32ede9)

Solutions

  1. Read the serialized body in the message — look for `code`/`error_description` fields that Aliyun may have used instead of `message`.
  2. Check network/proxy reachability to openapi.alipan.com (curl the endpoint); a gateway error page means a network problem, not an auth problem.
  3. Retry after a short wait if the status was 5xx (server-side issue).
  4. If Aliyun changed the error schema, update the parsing to check `code` too.
Defensive patterns

Strategy: retry

Validate before calling

if (!navigator.onLine) {
  throw new Error('offline: skip alipan backup operations');
}
// optionally pre-flight: const probe = await fetch('https://openapi.alipan.com');

Type guard

function isAliyunErrorBody(body) {
  if (body == null || typeof body !== 'object') return false;
  return typeof body.message === 'string' || typeof body.code === 'string' || typeof body.error_description === 'string';
}

Try / catch

try {
  await list(token);
} catch (e) {
  if (String(e.message).startsWith('Get accessToken Error')) {
    // body had no `message`: likely gateway/5xx — retry with backoff, then check network
    await delay(2000);
    return list(token);
  }
  throw e;
}

Prevention

When it happens

Trigger: list(token) gets an HTTP error response from openFile/list whose body is not the expected `{message: ...}` JSON — e.g. an HTML error page from a gateway/proxy, an empty body, or a JSON error object using different field names (`code`/`error_description` instead of `message`).

Common situations: Corporate proxy or GFW interference returning an HTML block page, alipan API gateway returning 502/504 with an empty body, or Aliyun changing their error envelope format.

Related errors


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