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.
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 argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- driveId is required with parentItemId
- siteId is required
- Specified SharePoint site is not connected for this…
- A new verification key is required when changing the embed…
- Agent name is required.
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/428b10d20acbab77.
Report an issue: GitHub.
Appendix: 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)