{"record":{"id":"5bbd5a8d3448eebf","repo":"Budibase/budibase","slug":"webhook-not-found","errorCode":null,"errorMessage":"Webhook not found","messagePattern":"Webhook not found","errorType":"http","errorClass":"HTTPError","httpStatus":404,"severity":"error","filePath":"packages/server/src/api/controllers/webhook.ts","lineNumber":116,"sourceCode":"      }\n      autoOutputs.properties[prop] = {\n        type: def.type as AutomationIOType,\n        description: AUTOMATION_DESCRIPTION,\n      }\n    }\n    await db.put(automation)\n  }\n  return await db.put(webhook)\n}\n\nexport async function buildSchema(ctx: BuildSchemaCtx) {\n  assertSchemaWorkspace(ctx.params.instance)\n\n  await context.doInWorkspaceContext(ctx.params.instance, async () => {\n    const db = context.getWorkspaceDB()\n    const webhook = await db.tryGet<Webhook>(ctx.params.id)\n    if (!webhook) {\n      throw new HTTPError(\"Webhook not found\", 404)\n    }\n    ctx.body = await updateWebhookSchema(ctx.request.body, webhook, db)\n  })\n}\n\nexport async function buildSchemaWithToken(ctx: BuildSchemaWithTokenCtx) {\n  assertSchemaWorkspace(ctx.params.instance)\n\n  await context.doInWorkspaceContext(ctx.params.instance, async () => {\n    const db = context.getWorkspaceDB()\n    const webhook = await db.tryGet<Webhook>(ctx.params.id)\n    if (\n      !webhook?.schemaToken ||\n      webhook.schemaToken !== ctx.params.schemaToken\n    ) {\n      throw new HTTPError(\"Invalid webhook schema token\", 403)\n    }\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/webhook.ts#L98-L134","documentation":"buildSchema looks up the webhook document by ctx.params.id via tryGet. Because tryGet returns null rather than throwing on a missing doc, the controller explicitly raises a 404 HTTPError when the webhook does not exist in the given workspace.","triggerScenarios":"POSTing to the webhook schema build endpoint with a webhook ID that is not present in the specified workspace's DB (wrong app ID, deleted webhook, ID typo).","commonSituations":"Using a webhook ID from a different app; webhook deleted while an external tool still holds its URL; case-sensitivity or truncation issues when copying IDs.","solutions":["Fetch the webhook list (GET /webhooks) for the workspace and use a valid webhook _id.","Confirm the app/instance ID in the request matches the app that owns the webhook.","Recreate the webhook if it was deleted, then retry the schema build.","Check for typos/truncation in the webhook ID path parameter."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const db = context.getWorkspaceDB()\nconst webhook = await db.tryGet<Webhook>(webhookId)\nif (!webhook) throw new Error(`Webhook ${webhookId} does not exist in this workspace`)","typeGuard":"const webhookExists = async (db: any, id: string): webhook is Webhook =>\n  Boolean(await db.tryGet<Webhook>(id))","tryCatchPattern":"try {\n  await api.post(`/webhooks/schema/${appId}/${webhookId}`)\n} catch (e) {\n  if (e.status === 404 && e.message === \"Webhook not found\") {\n    const webhooks = await api.get(`/webhooks`)\n    // pick the correct current webhook id from webhooks\n  } else throw e\n}","preventionTips":["Fetch the webhook list before calling the schema build to confirm the ID.","Always pair the webhook ID with its owning app ID.","Recreate webhooks instead of reusing old IDs after deletions.","Watch for ID truncation when copying from logs/URLs."],"tags":["webhook","http-404","not-found"],"backgroundTag":"referenced-resource-missing","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}