transloadit/uppy · error · Error

Failed to list folder contents for '${doc.name}' (${doc.id})

Error message

Failed to list folder contents for '${doc.name}' (${doc.id}): ${res.status} ${res.statusText}

What it means

Thrown while recursively expanding a picked Google Drive folder: the Drive v3 files.list call for the folder's children returned a non-OK HTTP status. The message includes the folder name/id and the HTTP status, so it identifies exactly which folder expansion failed during onPicked processing.

Source

Thrown at packages/@uppy/core/src/companion-client/googlePicker.ts:280

  let pageToken: string | undefined

  do {
    const params = new URLSearchParams({
      q: `'${doc.id.replace(/'/g, "\\'")}' in parents and trashed = false`,
      fields:
        'nextPageToken, files(id, name, mimeType, shortcutDetails(targetMimeType))',
      includeItemsFromAllDrives: 'true',
      supportsAllDrives: 'true',
      pageSize: '1000',
      ...(pageToken && { pageToken }),
    })
    const res = await fetch(
      `https://www.googleapis.com/drive/v3/files?${params.toString()}`,
      { headers, signal },
    )

    if (!res.ok) {
      throw new Error(
        `Failed to list folder contents for '${doc.name}' (${doc.id}): ${res.status} ${res.statusText}`,
      )
    }
    const json: { nextPageToken?: string; files: PickedItemBase[] } =
      await res.json()
    pageToken = json.nextPageToken

    for (const file of json.files) {
      items.push(
        ...(await handleDocObjectRecursively({ doc: file, token, signal })),
      )
    }
  } while (pageToken)

  return items
}

async function showDrivePicker({

View on GitHub (pinned to 5d4dedd02a)

Solutions

  1. Retry the pick/expand after a delay when status is 429/5xx
  2. Verify the token includes drive read scope and is still valid (the plugin refreshes via googleAccounts(); ensure onAccessTokenRequired re-authorizes)
  3. Request increased Drive API quota in Google Cloud Console
  4. Let the user pick files directly instead of huge folders to reduce list calls

Example fix

// before
// user picks folder -> Error: Failed to list folder contents for 'Big' (abc): 429 

// after
try {
  await uppy.googlePicker.showPicker()
} catch (err) {
  if (/Failed to list folder contents.*429/.test(err.message)) {
    uppy.info('Drive rate limit hit — try again in a minute', 'error', 5000)
  }
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

function isFolderListError(e: unknown): boolean {
  return e instanceof Error && e.message.startsWith('Failed to list folder contents')
}

Try / catch

try {
  await picker.showPicker()
} catch (err) {
  const m = /: (\d{3}) /.exec(err.message)
  if (m && (m[1] === '429' || m[1].startsWith('5'))) await retryPicker()
}

Prevention

When it happens

Trigger: After the user picks a Drive folder in the Google Picker, handleDocObjectRecursively fetches folder contents; if the Drive API responds non-OK (403 rate limit/quota, 401 token expired, 500) this error is thrown.

Common situations: Drive API quota exceeded; access token expired between picking and listing; insufficient Drive scopes for the folder; large folders paginated heavily hitting rate limits.

Related errors


AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28). Data as JSON: /api/errors/290d5187898ac059. Report an issue: GitHub.