pot-app/pot-desktop · error · Error

${result['message']}

Error message

${result['message']}

What it means

In the aliyun backup `list` function, when the openFile/list API returns a non-2xx status AND the response body contains a `message` field, that server-provided message is thrown verbatim. This surfaces the actual Aliyun Drive API error (auth, permission, parameter problems) directly to the caller.

Solutions

  1. If the message says the token is invalid/expired, redo the QR-code OAuth flow (qrcode() + status() + accessToken()) to get a fresh token.
  2. Check the message for scope/permission errors and re-authorize with the required scopes (user:base, file:all:read, file:all:write).
  3. Verify the token is actually stored in the backup config — an empty/undefined token yields 401.
  4. If the token is an old refresh token from a previous app version, re-link the account.
Defensive patterns

Strategy: try-catch

Validate before calling

function hasToken(config) {
  return typeof config.aliyunToken === 'string' && config.aliyunToken.length > 20;
}
// before calling list():
if (!hasToken(backupConfig)) openRelinkFlow();

Type guard

function isAliyunApiError(body) {
  return body != null && typeof body === 'object' && typeof body.message === 'string';
}

Try / catch

try {
  const names = await list(token);
} catch (e) {
  const msg = String(e.message);
  if (/AccessToken.*(Invalid|Expired)|401/i.test(msg)) {
    await reauthorizeAliyun(); // qrcode -> status -> accessToken flow
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: list(token) receives an HTTP error response from https://openapi.alipan.com/adrive/v1.0/openFile/list whose body has a `message` field — e.g. 401 AccessTokenInvalid/AccessTokenExpired, 403 permission denied, 400 bad drive_id.

Common situations: The saved alipan OAuth access token expired (they are short-lived), the token was revoked after re-login, or the app lost the file:all:read scope needed to list files.

Related errors


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

Appendix: source

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

            drive_id,
            parent_file_id: dir_id,
            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',

View on GitHub (pinned to 594d32ede9)