Budibase/budibase · error · HTTPError

Template description is required

Error message

Template description is required

What it means

This 400 HTTPError is thrown by the REST template upload controller when the multipart request's 'description' body field is missing or not a string. Description is required metadata stored alongside the uploaded OpenAPI template.

Source

Thrown at packages/server/src/api/controllers/restTemplate.ts:75

) => {
  const file = ctx.request.files?.file
  if (!file || Array.isArray(file)) {
    throw new HTTPError("Exactly one OpenAPI template file is required", 400)
  }

  const uploadDetails = getUploadDetails(file)
  if (!uploadDetails) {
    throw new HTTPError("Invalid OpenAPI template upload", 400)
  }

  try {
    const name = ctx.request.body.name
    const description = ctx.request.body.description
    if (typeof name !== "string" || !name.trim()) {
      throw new HTTPError("Template name is required", 400)
    }
    if (typeof description !== "string") {
      throw new HTTPError("Template description is required", 400)
    }

    const fileExtension = getFileExtension(uploadDetails.filename)
    const data = await readFile(uploadDetails.filepath, "utf8")
    let importer
    let info
    try {
      importer = await createImporter({ data })
      const source = importer.getSource().getImportSource()
      if (source !== "openapi2.0" && source !== "openapi3.0") {
        throw new Error("Unsupported OpenAPI source")
      }
      info = importer.getInfo()
    } catch {
      throw new HTTPError("File must contain a valid OpenAPI schema", 400)
    }

    ctx.body = {

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Add a string 'description' text field to the multipart form body
  2. Ensure description is a plain string (empty string is accepted; only non-strings are rejected)
  3. Retry the upload

Example fix

// before
formData.append("name", "My API Template") // description missing
// after
formData.append("name", "My API Template")
formData.append("description", "Petstore OpenAPI spec")
Defensive patterns

Strategy: validation

Validate before calling

const description = body.description
if (typeof description !== "string") {
  throw new Error("Template description must be a string before upload")
}

Type guard

const isString = (v: unknown): v is string => typeof v === "string"

Try / catch

try {
  await uploadTemplate(form)
} catch (e) {
  if (e?.status === 400 && e?.message === "Template description is required") {
    // mark description field as required in the form
  } else throw e
}

Prevention

When it happens

Trigger: POSTing to the custom REST template upload endpoint with a valid file and name but no 'description' field, or a description sent as a non-string value (null, number, object).

Common situations: Scripts that send only name + file; form UIs without a description field; clients forwarding JSON bodies where description is undefined.

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/fe68a00f78f60cb9. Report an issue: GitHub.