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

  1. Read the status: 404 means the site/list was deleted — re-pick the site and list in the knowledge source config.
  2. For 429, wait for the throttle window (Graph returns Retry-After) and retry; built-in retries cover up to 3 attempts.
  3. For 400, check that the siteId/listId are raw Graph IDs (not full URLs) and the token scope includes the site.
  4. 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

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


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/a3b1b9692aea7de7. Report an issue: GitHub.