Budibase/budibase · error · HTTPError

Project with id '${project._id}' not found.

Error message

Project with id '${project._id}' not found.

What it means

update() looks up the project via get(project._id) and, when no persisted project document exists for that id, throws this 404 HTTPError. Note get() also returns undefined for ids that do not carry the Project document prefix, so a wrong id type produces this error too.

Source

Thrown at packages/server/src/sdk/workspace/projects/crud.ts:107

  return response.doc
}

export async function update(project: UpdateProjectInput): Promise<Project> {
  if (!project._id) {
    throw new HTTPError("Project id is required.", 400)
  }
  if (!project._rev) {
    throw new HTTPError("Project revision is required.", 400)
  }
  if (Object.hasOwn(project, "name")) {
    validateProjectName(project.name)
  }

  const db = context.getWorkspaceDB()
  const persisted = await get(project._id)
  if (!persisted) {
    throw new HTTPError(`Project with id '${project._id}' not found.`, 404)
  }

  const response = await db.put(
    {
      ...persisted,
      ...project,
      ...(Object.hasOwn(project, "color")
        ? { color: normaliseProjectColor(project.color) }
        : {}),
      _rev: project._rev,
      createdAt: persisted.createdAt,
      updatedAt: new Date().toISOString(),
    },
    { returnDoc: true }
  )

  return response.doc
}

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Verify the _id is a real project id (correct prefix) and exists via sdk.projects.get in the same workspace context
  2. Ensure the request carries the correct workspace/app id so get() queries the right DB
  3. Re-fetch the project list and use a fresh id if the project was deleted
  4. Fix client code that substitutes the wrong entity id into update payloads

Example fix

// before
await sdk.projects.update({ _id: tableId, _rev, name }) // wrong id type
// after
const project = await sdk.projects.get(projectId)
if (!project) throw new Error("Project missing")
await sdk.projects.update({ _id: project._id!, _rev: project._rev, name })
Defensive patterns

Strategy: validation

Validate before calling

const existing = await sdk.projects.get(projectId)
if (!existing) throw new Error(`Project ${projectId} not found`)
await sdk.projects.update({ _id: existing._id!, _rev: existing._rev, ...changes })

Type guard

const isProjectDoc = (d: { _id?: string }): boolean =>
  typeof d._id === "string" && d._id.startsWith("proj_") // adjust to actual prefix via prefixed(DocumentType.PROJECT)

Try / catch

try {
  await sdk.projects.update(payload)
} catch (e) {
  if (String(e.message).includes("not found")) {
    // refresh project list / verify workspace context
  }
}

Prevention

When it happens

Trigger: Updating with an _id that was deleted elsewhere, an id from a different workspace DB (context points at the wrong workspace), a malformed/non-project id (missing the project doc prefix), or a typo'd/copied id.

Common situations: Stale client caches referencing deleted projects; passing a row/table id instead of a project id; multi-tenant mixups where the request context targets another app; ids truncated by string handling.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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