Budibase/budibase · error · Error

Provided webhook ID is not valid.

Error message

Provided webhook ID is not valid.

What it means

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.

Source

Thrown at packages/server/src/sdk/workspace/automations/webhook.ts:42

export async function save(webhook: Webhook) {
  const db = context.getWorkspaceDB()
  if (webhook._id && isWebhookID(webhook._id)) {
    const existing = await db.tryGet<Webhook>(webhook._id)
    webhook.schemaToken = existing?.schemaToken || utils.newid()
  } else {
    webhook._id = generateWebhookID()
    webhook.schemaToken = utils.newid()
  }
  const response = await db.put(webhook)
  webhook._rev = response.rev
  return webhook
}

export async function destroy(id: string, rev: string) {
  const db = context.getWorkspaceDB()
  if (!id || !isWebhookID(id)) {
    throw new Error("Provided webhook ID is not valid.")
  }
  return await db.remove(id, rev)
}

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Fetch the webhook via GET /api/automations/webhooks and use the exact _id returned
  2. Ensure the ID passed is the webhook document ID (with Budibase webhook prefix), not a slug or uuid
  3. Check that the route param is populated — an empty :id in the URL means the client built a bad link
  4. Re-create the webhook if the document was already removed

Example fix

// before
await sdk.automations.webhooks.destroy(webhook.slug, webhook.rev) // slug is not a valid ID
// after
const webhooks = await sdk.automations.webhooks.fetch()
const wh = webhooks.find(w => w._id === expectedId)
await sdk.automations.webhooks.destroy(wh._id!, wh._rev!)
Defensive patterns

Strategy: validation

Validate before calling

if (!id) throw new Error("Webhook ID is required for delete")

Type guard

function isWebhookId(id: string | undefined): id is string {
  return typeof id === "string" && id.length > 0
}

Try / catch

try {
  await sdk.automations.webhooks.destroy(id, rev)
} catch (err: any) {
  if (err.message.includes("webhook ID is not valid")) {
    // refetch webhook list to get the correct _id
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/764a98763bf7646f. Report an issue: GitHub.