{"record":{"id":"7fd83cf07180d93e","repo":"Budibase/budibase","slug":"project-with-id-project-id-not-found","errorCode":null,"errorMessage":"Project with id '${project._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":107,"sourceCode":"\n  return response.doc\n}\n\nexport async function update(project: UpdateProjectInput): Promise<Project> {\n  if (!project._id) {\n    throw new HTTPError(\"Project id is required.\", 400)\n  }\n  if (!project._rev) {\n    throw new HTTPError(\"Project revision is required.\", 400)\n  }\n  if (Object.hasOwn(project, \"name\")) {\n    validateProjectName(project.name)\n  }\n\n  const db = context.getWorkspaceDB()\n  const persisted = await get(project._id)\n  if (!persisted) {\n    throw new HTTPError(`Project with id '${project._id}' not found.`, 404)\n  }\n\n  const response = await db.put(\n    {\n      ...persisted,\n      ...project,\n      ...(Object.hasOwn(project, \"color\")\n        ? { color: normaliseProjectColor(project.color) }\n        : {}),\n      _rev: project._rev,\n      createdAt: persisted.createdAt,\n      updatedAt: new Date().toISOString(),\n    },\n    { returnDoc: true }\n  )\n\n  return response.doc\n}","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/projects/crud.ts#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the _id is a real project id (correct prefix) and exists via sdk.projects.get in the same workspace context","Ensure the request carries the correct workspace/app id so get() queries the right DB","Re-fetch the project list and use a fresh id if the project was deleted","Fix client code that substitutes the wrong entity id into update payloads"],"exampleFix":"// before\nawait sdk.projects.update({ _id: tableId, _rev, name }) // wrong id type\n// after\nconst project = await sdk.projects.get(projectId)\nif (!project) throw new Error(\"Project missing\")\nawait sdk.projects.update({ _id: project._id!, _rev: project._rev, name })","handlingStrategy":"validation","validationCode":"const existing = await sdk.projects.get(projectId)\nif (!existing) throw new Error(`Project ${projectId} not found`)\nawait sdk.projects.update({ _id: existing._id!, _rev: existing._rev, ...changes })","typeGuard":"const isProjectDoc = (d: { _id?: string }): boolean =>\n  typeof d._id === \"string\" && d._id.startsWith(\"proj_\") // adjust to actual prefix via prefixed(DocumentType.PROJECT)","tryCatchPattern":"try {\n  await sdk.projects.update(payload)\n} catch (e) {\n  if (String(e.message).includes(\"not found\")) {\n    // refresh project list / verify workspace context\n  }\n}","preventionTips":["Verify the workspace/app context matches where the project lives","Fetch the project immediately before update instead of using cached ids","Check the id prefix to avoid passing non-project ids (rows, tables)"],"tags":["http-404","not-found","update","wrong-id"],"backgroundTag":"resource-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}