pot-app/pot-desktop · error · Error

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

Error message

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

What it means

The aliyun (Aliyun Drive / alipan) backup `list` function throws this when the openFile/list API returns HTTP 2xx but the JSON body lacks an `items` field, meaning the response shape is not what the code expects. It dumps the whole response body so the developer can inspect what actually came back.

Source

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

        method: 'POST',
        headers: {
            Authorization: `Bearer ${token}`,
        },
        body: Body.json({
            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 });
}

View on GitHub (pinned to 594d32ede9)

Solutions

  1. Inspect the JSON in the message — the `code` field reveals the API-level error (e.g. InvalidParameter, NotFound.FileId).
  2. Re-authenticate to get a fresh token, then retry — a stale drive_id from an old token is the most common cause.
  3. Verify the drive_id returned by getDriveInfo matches the drive containing the pot-app folder.
  4. If the response schema changed, update the check to handle the new field names.
Defensive patterns

Strategy: validation

Validate before calling

function hasItems(result) {
  return result != null && typeof result === 'object' && Array.isArray(result.items);
}
// after fetch, before mapping:
if (res.ok && !hasItems(res.data)) {
  // handle unexpected schema / embedded error before .map
}

Type guard

function isFileListResult(data) {
  return data != null && typeof data === 'object' && Array.isArray(data['items']) && data['items'].every((i) => typeof i?.name === 'string');
}

Try / catch

try {
  const names = await list(token);
} catch (e) {
  if (String(e.message).startsWith('Get File List Error')) {
    const body = JSON.parse(String(e.message).replace('Get File List Error: ', ''));
    // inspect body.code (e.g. InvalidParameter) and re-auth if needed
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling list(token) where the POST to https://openapi.alipan.com/adrive/v1.0/openFile/list succeeds (res.ok) but the body contains e.g. `{code: 'InvalidParameter', ...}` with no `items` array — typically a drive_id or parent_file_id problem, or an API schema change.

Common situations: The access token is valid enough for 2xx but scoped to a different drive, the pot-app folder id is stale, or alipan changed the list response schema (e.g. items renamed or errors now returned with 200 status).

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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