Budibase/budibase · error · HTTPError
Specified SharePoint site is not connected for this operatio
Error message
Specified SharePoint site is not connected for this operation
What it means
During a per-source sync, the code finds the knowledge source matching sourceId within the operation's SharePoint sources and reads source.config.site. If the source exists but has no site configured, this 400 HTTPError is thrown, meaning the source record is present but incomplete — no SharePoint site was saved on it.
Source
Thrown at packages/server/src/sdk/workspace/ai/rag/sources/sharepoint/sharepoint.ts:731
sourceId: string,
signal?: AbortSignal
): Promise<SharePointSyncResult> => {
const lastRunAt = new Date().toISOString()
const agent = await agentsSdk.getOrThrow(agentId)
const sharepointSources = getSharePointSourcesForOperation(agent, operationId)
if (sharepointSources.length === 0) {
throw new HTTPError("SharePoint is not connected for this operation", 400)
}
const knowledgeSource = getSharePointSourcesForOperation(
agent,
operationId
).find(source => source.id === sourceId)
const site = knowledgeSource?.config.site
const sourceDatasourceId = knowledgeSource?.config.datasourceId
const sourceAuthConfigId = knowledgeSource?.config.authConfigId
if (!site) {
throw new HTTPError(
"Specified SharePoint site is not connected for this operation",
400
)
}
const siteId = site.id
const sourceScope = knowledgeSource?.config.scope
if (
!sourceScope ||
(sourceScope.mode !== SharePointScopeMode.ALL &&
sourceScope.mode !== SharePointScopeMode.SELECTED)
) {
throw new HTTPError(
"This SharePoint source uses an outdated configuration. Delete and reconnect it to continue syncing.",
400
)
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Reconnect the SharePoint source via the builder so config.site is saved
- Delete and re-add the knowledge source to the operation
- Inspect the agent document to confirm config.site (and datasourceId/authConfigId) are populated
- Check for schema/version drift between the saved source config and the current expected shape
Defensive patterns
Strategy: validation
Validate before calling
const agent = await agentsSdk.getOrThrow(agentId)
const source = getSharePointSourcesForOperation(agent, operationId).find(s => s.id === sourceId)
if (!source?.config?.site?.id) {
throw new Error(`Source ${sourceId} has no site configured`)
} Type guard
const hasSiteConfig = (
source: AgentSharePointKnowledgeSource | undefined
): source is AgentSharePointKnowledgeSource & {
config: { site: { id: string } }
} => typeof source?.config?.site?.id === "string" Try / catch
try {
await syncSharePointSourceForAgent(agentId, sourceId)
} catch (err) {
if (err instanceof HTTPError && err.status === 400 && err.message.includes("not connected for this operation")) {
// guide user to reconnect the source
} else { throw err }
} Prevention
- Require site selection to be completed before saving the source
- Validate source config shape at save time
- Re-save sources after upgrading schema
- Detect and flag sources with missing site in admin tooling
When it happens
Trigger: Calling sync with a sourceId whose knowledge source config lacks the site field — e.g. the source was created/validated without completing the site selection step.
Common situations: Source created by an older builder version before site config was required; partially completed connection wizard; config corrupted or manually edited; config site key missing after a schema/version change.
Related errors
- Error getting status
- Configuration invalid. Must contain clientID, clientSecret,
- datasourceId and authConfigId are required
- siteId is required
- driveId is required with parentItemId
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/ba5289b63bad800c.
Report an issue: GitHub.