transloadit/uppy · error · Error
Unexpected Facebook response: missing batch result
Error message
Unexpected Facebook response: missing batch result
What it means
The Facebook provider's list() uses a two-request batch (user profile for email + paginated content list) and requires both results to exist. If either responses[0] or responses[1] is missing, this error is thrown before parsing.
Source
Thrown at packages/@uppy/companion/src/server/provider/facebook/index.ts:171
if (secret == null) {
throw new Error('Facebook provider secret is not configured')
}
const responses = await runRequestBatch({
secret,
token,
requests: [
{
method: 'GET',
relative_url: `me?${new URLSearchParams({ fields: 'email' }).toString()}`,
},
{ method: 'GET', relative_url: `${path}?${new URLSearchParams(qs)}` },
],
})
const response1 = responses[0]
const response2 = responses[1]
if (!response1 || !response2) {
throw new Error('Unexpected Facebook response: missing batch result')
}
const { email } = response1.body as { email?: string }
const list = response2.body as FacebookListResponse
const currentQuery: Record<string, string> = {}
if (typeof cursor === 'string') currentQuery['cursor'] = cursor
return adaptData(list, email, directory, currentQuery)
})
}
override async download({
companion,
id,
providerUserSession: { accessToken: token },
}: {
companion: CompanionLikeView on GitHub (pinned to 5d4dedd02a)
Solutions
- Have the user reconnect Facebook to mint a fresh token
- Verify the app's granted permissions include what the profile + photos list calls need
- Check Companion logs for provider.facebook.list.error context around the failure
- Retry after reconnecting; transient Graph API errors are also possible
Defensive patterns
Strategy: try-catch
Type guard
function isCompleteBatch(responses: unknown[]): responses is [{ body: unknown }, { body: unknown }] {
return responses.length >= 2 && Boolean(responses[0]) && Boolean(responses[1])
} Try / catch
try {
const { items, username } = await facebookProvider.list({ token, directory, companion })
} catch (err) {
if (err instanceof Error && err.message.includes('missing batch result')) {
return promptReconnect('Facebook session expired — please reconnect.')
}
throw err
} Prevention
- Surface provider re-auth prompts when listing fails
- Track token age and proactively refresh Facebook sessions
- Handle partial Graph API batch failures in your own batch calls if you build custom providers
When it happens
Trigger: Browsing Facebook in the Dashboard (list or listWithPagination) when the Graph API batch endpoint returns fewer than two results — typically because one sub-request errored, permissions were revoked, or the token expired.
Common situations: Token invalidated by password change or app removal, missing Graph API permissions for the user-profile sub-request, or Facebook returning per-item errors inside the batch array.
Related errors
- Unexpected Facebook response: missing body
- Unexpected Facebook response: missing images
- Facebook provider secret is not configured
- call to thumbnail is not implemented
- File data is missing for file ${options.file.id}
AI-assisted analysis of transloadit/uppy@5d4dedd02a (2026-08-28).
Data as JSON: /api/errors/92c07acec8bb89ee.
Report an issue: GitHub.