{"record":{"id":"7283d8af2b750a35","repo":"Budibase/budibase","slug":"project-with-id-id-not-found","errorCode":null,"errorMessage":"Project with id '${id}' not found.","messagePattern":"Project with id '(.+?)' not found\\.","errorType":"http","errorClass":"HTTPError","httpStatus":404,"severity":"error","filePath":"packages/server/src/sdk/workspace/projects/crud.ts","lineNumber":250,"sourceCode":"      rollbacks.push(async () => {\n        await db.put({ ...original, _rev: result.rev })\n      })\n    }\n  } catch (err) {\n    if (!(err instanceof HTTPError)) {\n      await rollbackAssignments(rollbacks)\n    }\n    throw err\n  }\n\n  return rollbacks\n}\n\nexport async function remove(id: string, rev: string) {\n  const db = context.getWorkspaceDB()\n  const project = await get(id)\n  if (!project) {\n    throw new HTTPError(`Project with id '${id}' not found.`, 404)\n  }\n  if (project._rev !== rev) {\n    throw new HTTPError(\"Project revision does not match.\", 409)\n  }\n\n  const rollbacks = await clearAssignments(id)\n  try {\n    return await db.remove(id, rev)\n  } catch (err) {\n    await rollbackAssignments(rollbacks)\n    throw err\n  }\n}\n","sourceCodeStart":232,"sourceCodeEnd":264,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/projects/crud.ts#L232-L264","documentation":"This 404 HTTPError is thrown by the project (app) removal SDK function when the workspace database lookup for the given project id returns nothing. It means the caller asked to delete a project that does not exist in the current workspace DB, so the delete is aborted before any cascade work (assignments clearing, doc removal) runs.","triggerScenarios":"Calling remove(id, rev) where `get(id)` returns null/undefined: the id was already deleted, the id is malformed or belongs to another workspace/tenant, or a race where another request deleted the project first.","commonSituations":"Double-clicking a delete button and re-submitting the same DELETE request; stale UI listing a project deleted elsewhere; hardcoded/copy-pasted app ids across environments; tenant mismatch where the request context points at a different workspace DB.","solutions":["Verify the project id exists (GET the project or list projects) before deleting, using the same workspace context","Treat a 404 as idempotent success if the goal is 'project is gone' and skip the delete","Check that the request runs in the correct tenant/workspace context so getWorkspaceDB() resolves the right database","Confirm the id format matches what the API returned originally (no truncation, no URL-encoding issues)"],"exampleFix":"// before\nawait projects.remove(id, rev)\n// after\nconst project = await projects.get(id)\nif (project) {\n  await projects.remove(id, project._rev!)\n}","handlingStrategy":"try-catch","validationCode":"const project = await projects.get(id)\nif (!project) throw new Error(`Project ${id} does not exist; skip delete`)","typeGuard":"function isProject(p: unknown): p is Project\n  return !!p && typeof p === \"object\" && \"_id\" in p && \"_rev\" in p","tryCatchPattern":"try {\n  await projects.remove(id, rev)\n} catch (e) {\n  if (e?.status === 404) return // already gone: treat as idempotent success\n  throw e\n}","preventionTips":["Re-fetch the project immediately before delete to confirm existence and get a fresh rev","Guard delete buttons against double submission","Never hard-code project ids; always use ids returned by the API in the same tenant","Log the workspace/tenant context with delete attempts to catch context mismatches"],"tags":["http-404","rest-api","couchdb","deletion"],"backgroundTag":"resource-not-found-404","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}