Budibase/budibase · error
OIDC Config contents invalid
Error message
OIDC Config contents invalid
What it means
fetchSharePointCollection pages Graph collection endpoints (lists, columns, list items). On any non-ok response other than 401/403 it throws 'Failed to fetch SharePoint list data (<status>)'. Raised at connection.ts:508 for the generic collection fetch (used by listSharePointLists and column fetches).
Source
Thrown at packages/backend-core/src/auth/auth.ts:66
export const buildTenancyMiddleware = tenancy
export const buildCsrfMiddleware = csrf
export const passport = _passport
// Strategies
_passport.use(new LocalStrategy(local.options, local.authenticate))
async function refreshOIDCAccessToken(
chosenConfig: OIDCInnerConfig,
refreshToken: string
): Promise<RefreshResponse> {
const callbackUrl = await oidc.getCallbackUrl()
let enrichedConfig: OIDCStrategyConfiguration
let strategy: OpenIDConnectStrategy
try {
enrichedConfig = await oidc.fetchStrategyConfig(chosenConfig, callbackUrl)
if (!enrichedConfig) {
throw new Error("OIDC Config contents invalid")
}
strategy = await oidc.strategyFactory(enrichedConfig, ssoSaveUserNoOp)
} catch (err) {
throw new Error("Could not refresh OAuth Token")
}
refresh.use(strategy)
return new Promise(resolve => {
refresh.requestNewAccessToken(
ConfigType.OIDC,
refreshToken,
(err: any, accessToken: string, refreshToken: any, params: any) => {
resolve({ err, accessToken, refreshToken, params })
}
)
})
}View on GitHub (pinned to a81a902e9a)
Solutions
- Read the status: 404 means the site/list was deleted — re-pick the site and list in the knowledge source config.
- For 429, wait for the throttle window (Graph returns Retry-After) and retry; built-in retries cover up to 3 attempts.
- For 400, check that the siteId/listId are raw Graph IDs (not full URLs) and the token scope includes the site.
- Confirm admin-consented Sites.Read.All (or equivalent) application permission on the app registration.
Example fix
// before await fetchSharePointListDocument(token, "https://tenant.sharepoint.com/sites/x", listId) // 400 // after await fetchSharePointListDocument(token, site.graphId, listId) // raw Graph site ID
Defensive patterns
Strategy: try-catch
Validate before calling
if (!siteId || siteId.includes("sharepoint.com")) {
throw new Error("siteId must be a raw Graph site ID, not a URL")
} Type guard
const isSharePointHttpError = (e: unknown): e is { message: string; status: number } =>
typeof e === "object" && e !== null && "status" in e && typeof (e as { status: unknown }).status === "number" Try / catch
try {
const lists = await listSharePointLists(token, siteId)
} catch (e) {
if (isSharePointHttpError(e) && /list data \(404\)/.test(e.message)) {
// list or site deleted: refresh selection
} else throw e
} Prevention
- Re-validate site/list existence before each sync instead of trusting stored IDs.
- Distinguish statuses from the message (404 vs 429) and act accordingly.
- Retry 429/5xx with backoff before surfacing the error to users.
- Keep admin-consented Sites.Read.All on the app registration.
When it happens
Trigger: GET /v1.0/sites/{siteId}/lists, /lists/{listId}/columns, or a nextLink page returns 404, 400, 429-exhausted, or 5xx after requestWithRetries.
Common situations: Site or list deleted after being selected; listId with wrong encoding; malformed $select/$expand query rejected with 400; temporary Graph throttling that outlasted retries.
Related errors
- Koa context must be supplied to logout.
- Failed to fetch SharePoint drive item (${response.status})
- Failed to download SharePoint file (${response.status})
- Error getting account by email ${email}
- Error getting account by tenantId ${tenantId}
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/a3b1b9692aea7de7.
Report an issue: GitHub.