{"record":{"id":"764a98763bf7646f","repo":"Budibase/budibase","slug":"provided-webhook-id-is-not-valid","errorCode":null,"errorMessage":"Provided webhook ID is not valid.","messagePattern":"Provided webhook ID is not valid\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/automations/webhook.ts","lineNumber":42,"sourceCode":"\nexport async function save(webhook: Webhook) {\n  const db = context.getWorkspaceDB()\n  if (webhook._id && isWebhookID(webhook._id)) {\n    const existing = await db.tryGet<Webhook>(webhook._id)\n    webhook.schemaToken = existing?.schemaToken || utils.newid()\n  } else {\n    webhook._id = generateWebhookID()\n    webhook.schemaToken = utils.newid()\n  }\n  const response = await db.put(webhook)\n  webhook._rev = response.rev\n  return webhook\n}\n\nexport async function destroy(id: string, rev: string) {\n  const db = context.getWorkspaceDB()\n  if (!id || !isWebhookID(id)) {\n    throw new Error(\"Provided webhook ID is not valid.\")\n  }\n  return await db.remove(id, rev)\n}\n","sourceCodeStart":24,"sourceCodeEnd":46,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/automations/webhook.ts#L24-L46","documentation":"Thrown by webhook `destroy` when the id is falsy or fails the isWebhookID format check, preventing a DB remove with a malformed key. Budibase validates the webhook document ID shape before issuing a CouchDB delete.","triggerScenarios":"Deleting a webhook (DELETE /webhooks/{id} or sdk call to destroy) with an empty/undefined id, or an id that does not match Budibase's webhook ID prefix/format (e.g. a row ID, a URL slug, or a raw uuid).","commonSituations":"UI clients caching stale/malformed webhook identifiers; developers passing the webhook's trigger pipeline id rather than the webhook document _id; empty string after a failed URL param parse.","solutions":["Fetch the webhook via GET /api/automations/webhooks and use the exact _id returned","Ensure the ID passed is the webhook document ID (with Budibase webhook prefix), not a slug or uuid","Check that the route param is populated — an empty :id in the URL means the client built a bad link","Re-create the webhook if the document was already removed"],"exampleFix":"// before\nawait sdk.automations.webhooks.destroy(webhook.slug, webhook.rev) // slug is not a valid ID\n// after\nconst webhooks = await sdk.automations.webhooks.fetch()\nconst wh = webhooks.find(w => w._id === expectedId)\nawait sdk.automations.webhooks.destroy(wh._id!, wh._rev!)","handlingStrategy":"validation","validationCode":"if (!id) throw new Error(\"Webhook ID is required for delete\")","typeGuard":"function isWebhookId(id: string | undefined): id is string {\n  return typeof id === \"string\" && id.length > 0\n}","tryCatchPattern":"try {\n  await sdk.automations.webhooks.destroy(id, rev)\n} catch (err: any) {\n  if (err.message.includes(\"webhook ID is not valid\")) {\n    // refetch webhook list to get the correct _id\n  } else {\n    throw err\n  }\n}","preventionTips":["Persist the webhook _id, not its slug","Refetch webhooks before delete instead of using cached identifiers","Validate URL params before invoking the SDK"],"tags":["webhook","id-validation","automation"],"backgroundTag":"invalid-identifier","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}