Budibase/budibase · error · HTTPError
Project name is required.
Error message
Project name is required.
What it means
validateProjectName rejects any name that is not a non-empty, non-whitespace string. Called unconditionally by create and conditionally by update (when a name property is present), throwing this 400 HTTPError.
Source
Thrown at packages/server/src/sdk/workspace/projects/crud.ts:44
_rev: string
name?: string
description?: string
color?: string
}
type Rollback = () => Promise<void>
const normaliseProjectColor = (color?: string) => {
try {
return helpers.normaliseSafeCssColor(color)
} catch {
throw new HTTPError("Project color is invalid.", 400)
}
}
const validateProjectName = (name?: string) => {
if (typeof name !== "string" || !name.trim()) {
throw new HTTPError("Project name is required.", 400)
}
}
const isProjectId = (id?: string) =>
id?.startsWith(prefixed(DocumentType.PROJECT))
export async function fetch(): Promise<Project[]> {
const db = context.getWorkspaceDB()
const docs = await db.allDocs<Project>(
docIds.getProjectParams(null, { include_docs: true })
)
return docs.rows
.map(row => row.doc)
.filter((doc): doc is Project => !!doc)
.sort((a, b) => a.name.localeCompare(b.name))
}
View on GitHub (pinned to a81a902e9a)
Solutions
- Provide a non-empty trimmed name string when creating a project
- On update, omit the name property entirely rather than sending an empty value
- Trim client-side and require the field in your form before submitting
- Check payload construction for undefined values leaking into name
Example fix
// before
await sdk.projects.update({ _id, _rev, name: "" })
// after
await sdk.projects.update({ _id, _rev }) // omit name, or pass a real name Defensive patterns
Strategy: validation
Validate before calling
const nameIsValid = (n: unknown): n is string =>
typeof n === "string" && n.trim().length > 0
if (!nameIsValid(input.name)) throw new Error("Project name is required") Type guard
const hasName = (v: unknown): v is { name: string } =>
typeof v === "object" && v !== null && "name" in v &&
typeof (v as { name: unknown }).name === "string" && (v as { name: string }).name.trim() !== "" Try / catch
try {
await sdk.projects.create({ name })
} catch (e) {
if (String(e.message).includes("name is required")) {
// surface a required-field error to the user
}
} Prevention
- Make name a required field in forms; trim before submit
- On update, omit name instead of sending an empty string
- Trim whitespace-only names client-side
When it happens
Trigger: create({ name: undefined }) or name: "" or " "; update({ _id, _rev, name: "" }) — sending the name key with an empty value triggers validation even though name is optional in updates.
Common situations: Forms allowing blank submission; API clients sending name: "" to 'clear' a name (not supported); destructuring payloads where name is absent on create; whitespace-only input passing a naive required check.
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
- Project id is required.
- Invalid bookmark query
- Invalid limit query
- Limit query must be between 1 and 100
- Invalid ${queryName} query
AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29).
Data as JSON: /api/errors/0e90af89ddce98b3.
Report an issue: GitHub.