{"record":{"id":"b58076e62c428095","repo":"Budibase/budibase","slug":"this-sharepoint-source-uses-an-outdated-configurat","errorCode":null,"errorMessage":"This SharePoint source uses an outdated configuration. Delete and reconnect it to continue syncing.","messagePattern":"This SharePoint source uses an outdated configuration\\. Delete and reconnect it to continue syncing\\.","errorType":"http","errorClass":"HTTPError","httpStatus":400,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/rag/sources/sharepoint/sharepoint.ts","lineNumber":744,"sourceCode":"  ).find(source => source.id === sourceId)\n  const site = knowledgeSource?.config.site\n  const sourceDatasourceId = knowledgeSource?.config.datasourceId\n  const sourceAuthConfigId = knowledgeSource?.config.authConfigId\n  if (!site) {\n    throw new HTTPError(\n      \"Specified SharePoint site is not connected for this operation\",\n      400\n    )\n  }\n\n  const siteId = site.id\n  const sourceScope = knowledgeSource?.config.scope\n  if (\n    !sourceScope ||\n    (sourceScope.mode !== SharePointScopeMode.ALL &&\n      sourceScope.mode !== SharePointScopeMode.SELECTED)\n  ) {\n    throw new HTTPError(\n      \"This SharePoint source uses an outdated configuration. Delete and reconnect it to continue syncing.\",\n      400\n    )\n  }\n\n  console.log(\"Starting SharePoint sync for agent\", {\n    agentId,\n    sourceId: sourceId,\n    siteId,\n    runAt: lastRunAt,\n    sourceScope,\n  })\n  throwIfSyncAborted(signal)\n\n  if (!sourceDatasourceId || !sourceAuthConfigId) {\n    throw new HTTPError(\"SharePoint is not connected for this workspace\", 400)\n  }\n  const bearerToken = await getSharePointBearerToken(","sourceCodeStart":726,"sourceCodeEnd":762,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/rag/sources/sharepoint/sharepoint.ts#L726-L762","documentation":"The sync path requires the knowledge source's scope to have mode ALL or SELECTED. If config.scope is missing or its mode is not one of these two recognized values, this 400 HTTPError is thrown and the user is told to delete and reconnect the source, because the saved scope predates the current scope schema and cannot be interpreted.","triggerScenarios":"Syncing a source whose saved config has no scope or a legacy scope.mode value (anything other than 'all' or 'selected') — typically a source created before the scope-mode format was introduced.","commonSituations":"Upgraded deployment with old agent documents; source saved by an older builder version; manually patched agent config; partial migration of knowledge-source schema.","solutions":["Delete the SharePoint knowledge source and reconnect it (as the error states) so it saves the current scope schema","Re-save the source's scope in the builder to refresh config.scope to mode ALL or SELECTED","Check the agent document and rewrite config.scope to { mode: \"all\" } or { mode: \"selected\", targets: [...] } if direct DB fix is acceptable","Upgrade the agent creation code path so new sources always persist a valid scope"],"exampleFix":"// before (legacy saved config)\n{ id: \"ks_1\", config: { site: {...}, datasourceId: \"ds\", authConfigId: \"ac\" } }\n// after (reconnect/re-save with current schema)\n{ id: \"ks_1\", config: { site: {...}, datasourceId: \"ds\", authConfigId: \"ac\", scope: { mode: \"selected\", targets: [{ type: \"drive\", driveId: \"b!abc\" }] } } }","handlingStrategy":"validation","validationCode":"const scope = source?.config?.scope\nif (!scope || (scope.mode !== \"all\" && scope.mode !== \"selected\")) {\n  throw new Error(\"Source scope uses an outdated schema; reconnect required\")\n}","typeGuard":"const hasValidScope = (\n  source: AgentSharePointKnowledgeSource | undefined\n): source is AgentSharePointKnowledgeSource & {\n  config: { scope: AgentSharePointKnowledgeSourceScope }\n} =>\n  source?.config?.scope?.mode === SharePointScopeMode.ALL ||\n  source?.config?.scope?.mode === SharePointScopeMode.SELECTED","tryCatchPattern":"try {\n  await syncSharePointSourceForAgent(agentId, sourceId)\n} catch (err) {\n  if (err instanceof HTTPError && err.status === 400 && err.message.includes(\"outdated configuration\")) {\n    // show reconnect flow to the user\n  } else { throw err }\n}","preventionTips":["Run migrations over old agent documents when scope schema changes","Always persist an explicit scope on new sources","Surface 'outdated source' warnings in the builder before sync attempts","Version the source config schema and check on read"],"tags":["sharepoint","schema-migration","configuration"],"backgroundTag":"outdated-config-schema","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}