Budibase/budibase · warning · HTTPError

Template name must contain letters or numbers

Error message

Template name must contain letters or numbers

What it means

A 400 HTTPError thrown when creating a custom REST template whose name, after kebab-case normalization, produces an empty string. The SDK requires template names to contain at least one letter or digit so a usable identifier can be derived.

Source

Thrown at packages/server/src/sdk/workspace/restTemplates.ts:95

  return response.rows
    .map(row => row.doc as CustomRestTemplateDocument | undefined)
    .filter(
      (document): document is CustomRestTemplateDocument => document != null
    )
    .map(toRestTemplate)
}

const createWithoutLock = async ({
  name,
  description,
  data,
  fileExtension,
  operationsCount,
}: CreateCustomRestTemplateParams): Promise<RestTemplate> => {
  const db = context.getWorkspaceDB()
  const normalizedName = kebabCase(name)
  if (!normalizedName) {
    throw new HTTPError("Template name must contain letters or numbers", 400)
  }

  const existingTemplate = (await fetch()).find(
    template => kebabCase(template.name) === normalizedName
  )
  if (existingTemplate) {
    throw new HTTPError(
      `A custom REST template named "${name.trim()}" already exists`,
      409
    )
  }

  const restTemplateId = dbCore.generateRestTemplateID()
  const existing = await db.tryGet<CustomRestTemplateDocument>(restTemplateId)
  if (existing) {
    throw new HTTPError(
      `A custom REST template named "${name.trim()}" already exists`,
      409

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Provide a name containing at least one alphanumeric character before calling create
  2. Trim the input and validate client-side that /[a-z0-9]/i matches before submitting
  3. If the display name is symbolic, prefix it with a meaningful word (e.g. "alpha-###")
  4. Return a clear field-level validation error to the user instead of submitting

Example fix

// before
await restTemplates.create({ name: "---" })
// after
const name = userInput.trim()
if (!/[a-z0-9]/i.test(name)) throw new Error("Name needs letters/numbers")
await restTemplates.create({ name })
Defensive patterns

Strategy: validation

Validate before calling

if (!/[a-z0-9]/i.test(name ?? "")) throw new Error("Template name must contain letters or numbers")

Type guard

function isValidTemplateName(name: unknown): name is string
  return typeof name === "string" && /[a-z0-9]/i.test(name)

Try / catch

try {
  await restTemplates.create({ name })
} catch (e) {
  if (e?.status === 400 && /letters or numbers/.test(e.message)) {
    throw new ValidationError("Please enter a name with letters or numbers")
  }
  throw e
}

Prevention

When it happens

Trigger: Calling create (createWithoutLock) with name consisting only of characters stripped by kebabCase — e.g. "---", "___", spaces, or punctuation-only strings — or an empty/whitespace-only name.

Common situations: UI form validation gap allowing a symbol-only template name; programmatic generation producing a name of only special characters; pasting a label like "###" as the template name; localization where the name is entirely non-ASCII symbols.

Related errors


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