Budibase/budibase · error · HTTPError
Config ID is required
Error message
Config ID is required
What it means
deleteAIConfig reads the config id from the route params and refuses to call sdk.ai.configs.remove when it is absent, returning 400 'Config ID is required'. This guards against routing misconfiguration or calls made to the base path without an id segment.
Source
Thrown at packages/server/src/api/controllers/ai/configs.ts:152
model: body.model,
webSearchConfig: body.webSearchConfig,
configType,
reasoningEffort: body.reasoningEffort,
isDefault: body.isDefault,
}
const updatedConfig = await sdk.ai.configs.update(updateRequest)
ctx.body = await sanitizeConfig(updatedConfig)
}
export const deleteAIConfig = async (
ctx: UserCtx<{ id: string }, { deleted: true }>
) => {
const { id } = ctx.params
if (!id) {
throw new HTTPError("Config ID is required", 400)
}
await sdk.ai.configs.remove(id)
ctx.body = { deleted: true }
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Ensure the DELETE request targets /api/ai/configs/:id with a real id in the URL.
- Log/inspect the URL before sending; guard client code against undefined ids before issuing the request.
- Remove the config from local state only after a successful DELETE response.
- If ids come from a list, ensure the item's _id (not a UI-only index) is used in the path.
Example fix
// before
const id = selected?._id
await api.delete(`/api/ai/configs/${id}`) // id may be undefined -> /api/ai/configs/undefined
// after
if (!selected?._id) return
await api.delete(`/api/ai/configs/${selected._id}`) Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof configId !== "string" || !configId) {
throw new Error("Cannot delete AI config without an id")
}
await api.delete(`/api/ai/configs/${configId}`) Type guard
const isNonEmptyString = (v: unknown): v is string => typeof v === "string" && v.length > 0
Try / catch
try {
await api.delete(`/api/ai/configs/${id}`)
} catch (e) {
if (e.status === 400 && e.message.includes("Config ID is required")) {
// URL was built with a missing/undefined id — do not remove from local state
}
} Prevention
- Guard client code before interpolating ids into URLs
- Only clear local state after a successful delete response
- Verify route wiring maps the delete handler to /:id, not the collection path
- Use resource _id, not list indices, for delete calls
When it happens
Trigger: DELETE to the ai configs route without an id path parameter (route hit at collection level), or an id that is empty/undefined due to template interpolation of an undefined variable in the client URL.
Common situations: Client code building the URL with an undefined config id (`/api/ai/configs/${id}` where id is undefined); router misconfiguration matching the delete handler to the collection route; deleting after an optimistic local removal that already cleared the id from state.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- Config name is required
- Config ID is required for updates
- Invalid bookmark query
- Invalid limit query
- Limit query must be between 1 and 100
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/c289623843b462ef.
Report an issue: GitHub.