Budibase/budibase · error · HTTPError

Project app with id '${workspaceAppId}' not found.

Error message

Project app with id '${workspaceAppId}' not found.

What it means

remove() tries to fetch the workspace app with db.tryGet; if it does not exist it throws a 404 HTTPError before attempting deletion. The surrounding catch also re-wraps any 404-status error with the same message.

Source

Thrown at packages/server/src/sdk/workspace/workspaceApps/crud.ts:181

    createdAt: persisted.createdAt,
    updatedAt: persisted.updatedAt,
    isDefault: persisted.isDefault,
    _deleted: undefined,
  }
  const response = await db.put(docToUpdate, { returnDoc: true })
  events.workspace.appUpdated(response.doc, context.getWorkspaceId()!)
  return response.doc
}

export async function remove(
  workspaceAppId: string,
  _rev: string
): Promise<void> {
  const db = context.getWorkspaceDB()
  try {
    const existing = await db.tryGet<WorkspaceApp>(workspaceAppId)
    if (!existing)
      throw new HTTPError(
        `Project app with id '${workspaceAppId}' not found.`,
        404
      )

    await db.remove(workspaceAppId, _rev)

    // Clear out any favourites related to this
    events.workspace.appDeleted(existing, context.getWorkspaceId()!)
  } catch (e: any) {
    if (e.status === 404) {
      throw new HTTPError(
        `Project app with id '${workspaceAppId}' not found.`,
        404
      )
    }
    throw e
  }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Check existence with sdk.workspaceApps.get(id) before calling remove
  2. Treat 404 as idempotent success if the goal is 'ensure deleted'
  3. Confirm the workspace context/DB contains the doc (fetch first)

Example fix

// before
await sdk.workspaceApps.remove(id, rev)
// after
const existing = await sdk.workspaceApps.get(id)
if (existing) await sdk.workspaceApps.remove(id, existing._rev!)
Defensive patterns

Strategy: try-catch

Validate before calling

const existing = await sdk.workspaceApps.get(workspaceAppId)
if (!existing) return // nothing to delete

Type guard

function isWorkspaceApp(doc) {
  return !!doc && typeof doc === 'object' && '_id' in doc && '_rev' in doc
}

Try / catch

try {
  await sdk.workspaceApps.remove(id, rev)
} catch (e) {
  if (e?.status === 404) return // treat as already deleted
  throw e
}

Prevention

When it happens

Trigger: Calling sdk.workspaceApps.remove(workspaceAppId, _rev) with an id that is not present in the workspace DB — already deleted, never existed, or wrong workspace context.

Common situations: Double-delete (retry after a successful removal); deleting from a UI list that is stale; ids passed from another app's DB; wrong context so the lookup misses.

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