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
- Retry the pick/expand after a delay when status is 429/5xx
- Verify the token includes drive read scope and is still valid (the plugin refreshes via googleAccounts(); ensure onAccessTokenRequired re-authorizes)
- Request increased Drive API quota in Google Cloud Console
- 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
- Refresh tokens via onAccessTokenRequired for long expand operations
- Discourage picking very large folders
- Watch Drive API quota in Cloud Console
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
- OAuth2 error: ${response.error}
- Failed to create a session
- Failed to get a media items
- Failed to get session
- Transloadit: Assembly status is missing `assembly_id`.
AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28).
Data as JSON: /api/errors/290d5187898ac059.
Report an issue: GitHub.