{"record":{"id":"a3b1b9692aea7de7","repo":"Budibase/budibase","slug":"oidc-config-contents-invalid","errorCode":null,"errorMessage":"OIDC Config contents invalid","messagePattern":"OIDC Config contents invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend-core/src/auth/auth.ts","lineNumber":66,"sourceCode":"export const buildTenancyMiddleware = tenancy\nexport const buildCsrfMiddleware = csrf\nexport const passport = _passport\n\n// Strategies\n_passport.use(new LocalStrategy(local.options, local.authenticate))\n\nasync function refreshOIDCAccessToken(\n  chosenConfig: OIDCInnerConfig,\n  refreshToken: string\n): Promise<RefreshResponse> {\n  const callbackUrl = await oidc.getCallbackUrl()\n  let enrichedConfig: OIDCStrategyConfiguration\n  let strategy: OpenIDConnectStrategy\n\n  try {\n    enrichedConfig = await oidc.fetchStrategyConfig(chosenConfig, callbackUrl)\n    if (!enrichedConfig) {\n      throw new Error(\"OIDC Config contents invalid\")\n    }\n    strategy = await oidc.strategyFactory(enrichedConfig, ssoSaveUserNoOp)\n  } catch (err) {\n    throw new Error(\"Could not refresh OAuth Token\")\n  }\n\n  refresh.use(strategy)\n\n  return new Promise(resolve => {\n    refresh.requestNewAccessToken(\n      ConfigType.OIDC,\n      refreshToken,\n      (err: any, accessToken: string, refreshToken: any, params: any) => {\n        resolve({ err, accessToken, refreshToken, params })\n      }\n    )\n  })\n}","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/backend-core/src/auth/auth.ts#L48-L84","documentation":"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).","triggerScenarios":"GET /v1.0/sites/{siteId}/lists, /lists/{listId}/columns, or a nextLink page returns 404, 400, 429-exhausted, or 5xx after requestWithRetries.","commonSituations":"Site or list deleted after being selected; listId with wrong encoding; malformed $select/$expand query rejected with 400; temporary Graph throttling that outlasted retries.","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."],"exampleFix":"// before\nawait fetchSharePointListDocument(token, \"https://tenant.sharepoint.com/sites/x\", listId) // 400\n// after\nawait fetchSharePointListDocument(token, site.graphId, listId) // raw Graph site ID","handlingStrategy":"try-catch","validationCode":"if (!siteId || siteId.includes(\"sharepoint.com\")) {\n  throw new Error(\"siteId must be a raw Graph site ID, not a URL\")\n}","typeGuard":"const isSharePointHttpError = (e: unknown): e is { message: string; status: number } =>\n  typeof e === \"object\" && e !== null && \"status\" in e && typeof (e as { status: unknown }).status === \"number\"","tryCatchPattern":"try {\n  const lists = await listSharePointLists(token, siteId)\n} catch (e) {\n  if (isSharePointHttpError(e) && /list data \\(404\\)/.test(e.message)) {\n    // list or site deleted: refresh selection\n  } else throw e\n}","preventionTips":["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."],"tags":["sharepoint","microsoft-graph","http","api"],"backgroundTag":"graph-api-request-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}