Budibase/budibase · error · HTTPError

Config name is required

Error message

Config name is required

What it means

createAIConfig requires a name on the request body before delegating to sdk.ai.configs.create. An empty/undefined name fails this guard and the endpoint returns 400 'Config name is required'.

Source

Thrown at packages/server/src/api/controllers/ai/configs.ts:85

  }
  ctx.body = result
}

export const fetchAIProviders = async (
  ctx: UserCtx<void, LLMProvidersResponse>
) => {
  const allProviders = await sdk.ai.configs.fetchLiteLLMProviders()
  const providers = allProviders.filter(p => p.id !== BUDIBASE_AI_PROVIDER_ID)
  ctx.body = providers
}

export const createAIConfig = async (
  ctx: UserCtx<CreateAIConfigRequest, AIConfigResponse>
) => {
  const body = ctx.request.body

  if (!body.name) {
    throw new HTTPError("Config name is required", 400)
  }

  const createRequest: RequiredKeys<
    Parameters<typeof sdk.ai.configs.create>[0]
  > = {
    name: body.name,
    provider: body.provider,
    credentialsFields: body.credentialsFields,
    model: body.model,

    webSearchConfig: body.webSearchConfig,
    configType: body.configType,
    reasoningEffort: body.reasoningEffort,
    isDefault: body.isDefault,
  }

  const newConfig = await sdk.ai.configs.create(createRequest)

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Include a non-empty name field in the POST body.
  2. Send the request with Content-Type: application/json so the body is parsed.
  3. In UI integrations, validate the name input is non-empty before submitting.
  4. If calling programmatically, spread the config object and confirm name survives (no key renaming).

Example fix

// before
await api.post("/api/ai/configs", { provider: "litellm-main", credentialsFields: {} })
// after
await api.post("/api/ai/configs", { name: "My GPT Config", provider: "litellm-main", credentialsFields: {} })
Defensive patterns

Strategy: validation

Validate before calling

if (typeof config.name !== "string" || !config.name.trim()) {
  throw new Error("AI config name is required before calling create")
}

Type guard

const hasName = (b: { name?: string }): b is { name: string } =>
  typeof b.name === "string" && b.name.trim().length > 0

Try / catch

try {
  await api.post("/api/ai/configs", config)
} catch (e) {
  if (e.status === 400 && e.message === "Config name is required") {
    // prompt user for a name / fix payload and retry once
  }
}

Prevention

When it happens

Trigger: POST /api/ai/configs with a JSON body missing the name field, name set to "" or null, or Content-Type not application/json so the body parses without name.

Common situations: Scripted/API clients forgetting the field; form UI not binding the name input; sending multipart or wrong content type so ctx.request.body is empty.

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


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/2d3815d0764a6cc1. Report an issue: GitHub.