Budibase/budibase · error · HTTPError
datasourceId and authConfigId are required
Error message
datasourceId and authConfigId are required
What it means
Thrown by fetchAgentKnowledgeSourceOptions with HTTP 400 when either the datasourceId or authConfigId path parameter is missing or empty. Both are required to look up the SharePoint sites configured for a datasource auth credential.
Source
Thrown at packages/server/src/api/controllers/ai/files.ts:298
const url = await sdk.ai.rag.getFileUrlForOperation(
agentId,
operationId,
fileId
)
ctx.body = { url }
ctx.status = 200
}
export async function fetchAgentKnowledgeSourceOptions(
ctx: UserCtx<
void,
FetchAgentKnowledgeSourceOptionsResponse,
{ datasourceId: string; authConfigId: string }
>
) {
const { datasourceId, authConfigId } = ctx.params
if (!datasourceId || !authConfigId) {
throw new HTTPError("datasourceId and authConfigId are required", 400)
}
ctx.body = {
options: await fetchSharePointSitesByDatasourceAuthConfig(
datasourceId,
authConfigId
),
}
ctx.status = 200
}
export async function fetchAgentKnowledgeSourceEntries(
ctx: UserCtx<
void,
FetchAgentKnowledgeSourceEntriesResponse,
{ agentId: string; operationId: string }
>
) {
const { agentId, operationId } = ctx.paramsView on GitHub (pinned to a81a902e9a)
Solutions
- Resolve both datasourceId and authConfigId from the datasource configuration before calling.
- URL-encode path params and avoid passing empty strings for unset IDs.
- Complete the datasource auth configuration first, then fetch options.
- Log the full request URL to confirm both segments are present.
Example fix
// before
await api.get(`/ai/knowledge-sources/options/${dsId}/${authId ?? ""}`)
// after
if (!dsId || !authId) throw new Error("datasourceId and authConfigId are required")
await api.get(`/ai/knowledge-sources/options/${encodeURIComponent(dsId)}/${encodeURIComponent(authId)}`) Defensive patterns
Strategy: validation
Validate before calling
if (!datasourceId || !authConfigId) throw new Error("datasourceId and authConfigId are required")
const res = await api.getKnowledgeSourceOptions({ datasourceId, authConfigId }) Try / catch
try {
const { options } = await api.getKnowledgeSourceOptions({ datasourceId, authConfigId })
} catch (err) {
if (err.status === 400 && err.message.includes("datasourceId")) {
// fix route params before retrying
} else throw err
} Prevention
- Always resolve both datasourceId and authConfigId from the datasource config before calling.
- URL-encode path params and avoid empty strings from unset state.
- Disable the SharePoint picker UI until both IDs are known.
- Log the request URL when integration setup is incomplete.
When it happens
Trigger: Calling the SharePoint site-options endpoint without both params in the path; empty string params from unconfigured datasource state; malformed route usage omitting one of the two segments.
Common situations: Frontend navigating to the site picker before the datasource/auth config is saved; URL built by concatenation with an undefined ID; integration setup incomplete so authConfigId does not exist yet.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- siteId is required
- driveId is required with parentItemId
- Specified SharePoint site is not connected for this operatio
- Error getting status
- Invalid bookmark query
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/428b10d20acbab77.
Report an issue: GitHub.