{"record":{"id":"47931d0ea84caf3d","repo":"Budibase/budibase","slug":"workspace-app-not-found-workspaceappid","errorCode":null,"errorMessage":"Workspace app not found ${workspaceAppId}","messagePattern":"Workspace app not found (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/builder/src/stores/builder/workspaceApps.ts","lineNumber":184,"sourceCode":"    this.store.update(state => {\n      return {\n        ...state,\n        workspaceApps: state.workspaceApps.filter(app => app._id !== id),\n      }\n    })\n\n    const { deploymentStore } = await import(\"./deployment\")\n\n    await deploymentStore.publishApp()\n    appStore.refresh()\n  }\n\n  async toggleDisabled(workspaceAppId: string, state: boolean) {\n    const workspaceApp = get(this.store).workspaceApps.find(\n      app => app._id === workspaceAppId\n    )\n    if (!workspaceApp) {\n      throw new Error(`Workspace app not found ${workspaceAppId}`)\n    }\n    workspaceApp.disabled = state\n    await this.edit({\n      ...workspaceApp,\n      disabled: state,\n    })\n\n    const { deploymentStore } = await import(\"./deployment\")\n    await deploymentStore.publishApp()\n  }\n\n  replaceDatasource(_id: string, workspaceApp: WorkspaceApp) {\n    const index = get(this.store).workspaceApps.findIndex(\n      x => x._id === workspaceApp._id\n    )\n\n    this.store.update(state => {\n      state.workspaceApps[index] = workspaceApp","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/builder/src/stores/builder/workspaceApps.ts#L166-L202","documentation":"toggleDisabled looks up the workspace app in the local store by _id before mutating it. If no app with the given id exists in store state, it throws immediately without touching the server, since the local edit flow requires the existing record.","triggerScenarios":"Calling toggleDisabled(workspaceAppId, state) with an id that isn't in the store — wrong id, app deleted concurrently, or store never fetched/refreshed.","commonSituations":"Hard-coded or stale ids after deleting a workspace app; forgetting to await the initial fetch before toggling; multi-tab scenarios where another tab deleted the app; typo in id.","solutions":["Fetch/refresh the workspace apps store before toggling","Verify the workspaceAppId is a valid, existing app id","Handle the app having been deleted — check existence first and surface a friendly message","Reload the page or re-fetch the list if state is stale"],"exampleFix":"// before\nawait workspaceApps.toggleDisabled(id, false)\n// after\nconst app = get(workspaceApps).workspaceApps.find(a => a._id === id)\nif (!app) { await workspaceApps.fetch(); return }\nawait workspaceApps.toggleDisabled(id, false)","handlingStrategy":"validation","validationCode":"const app = get(workspaceApps).workspaceApps.find(a => a._id === workspaceAppId)\nif (!app) {\n  await workspaceApps.fetch()\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await workspaceApps.toggleDisabled(id, state)\n} catch (e) {\n  if (e.message.startsWith(\"Workspace app not found\")) {\n    await workspaceApps.fetch()\n  } else throw e\n}","preventionTips":["Always fetch the store before toggling by id","Verify ids come from freshly rendered list items","Re-fetch after any delete operation to avoid stale ids","Log the id and store contents when debugging not-found errors"],"tags":["builder","workspace-apps","not-found","state"],"backgroundTag":"entity-not-found","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}