{"record":{"id":"b3ea2681d1a79831","repo":"calcom/cal.diy","slug":"webhook-with-this-subscriber-url-already-exists-fo-b3ea26","errorCode":null,"errorMessage":"Webhook with this subscriber url already exists for this event type","messagePattern":"Webhook with this subscriber url already exists for this event type","errorType":"http","errorClass":"ConflictException","httpStatus":409,"severity":"error","filePath":"apps/api/v2/src/modules/webhooks/services/team-event-type-webhooks.service.ts","lineNumber":25,"sourceCode":"@Injectable()\nexport class TeamEventTypeWebhooksService {\n  constructor(private readonly webhooksRepository: WebhooksRepository) {}\n\n  async createTeamEventTypeWebhook(eventTypeId: number, body: PipedInputWebhookType) {\n    validateWebhookUrl(body.subscriberUrl);\n\n    if (body.eventTriggers.includes(WebhookTriggerEvents.DELEGATION_CREDENTIAL_ERROR)) {\n      throw new BadRequestException(\n        \"DELEGATION_CREDENTIAL_ERROR trigger is only available for organization webhooks\"\n      );\n    }\n\n    const existingWebhook = await this.webhooksRepository.getEventTypeWebhookByUrl(\n      eventTypeId,\n      body.subscriberUrl\n    );\n    if (existingWebhook) {\n      throw new ConflictException(\"Webhook with this subscriber url already exists for this event type\");\n    }\n    return this.webhooksRepository.createEventTypeWebhook(eventTypeId, {\n      ...body,\n      payloadTemplate: body.payloadTemplate ?? null,\n      secret: body.secret ?? null,\n    });\n  }\n\n  getTeamEventTypeWebhooksPaginated(eventTypeId: number, skip: number, take: number) {\n    return this.webhooksRepository.getEventTypeWebhooksPaginated(eventTypeId, skip, take);\n  }\n\n  async deleteAllTeamEventTypeWebhooks(eventTypeId: number): Promise<{ count: number }> {\n    return this.webhooksRepository.deleteAllEventTypeWebhooks(eventTypeId);\n  }\n}\n","sourceCodeStart":7,"sourceCodeEnd":42,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/webhooks/services/team-event-type-webhooks.service.ts#L7-L42","documentation":"TeamEventTypeWebhooksService.createTeamEventTypeWebhook calls getEventTypeWebhookByUrl(eventTypeId, subscriberUrl); a pre-existing row causes ConflictException (HTTP 409). The same backing repository method is shared with regular event-type webhooks, so the (eventTypeId, subscriberUrl) uniqueness applies.","triggerScenarios":"POSTing a team event-type webhook with a subscriberUrl already registered against the same eventTypeId.","commonSituations":"Retries that succeeded server-side; shared callback URL across team integrations; reused ngrok/dev URL.","solutions":["List team event-type webhooks and check subscriberUrl before creating.","Use unique subscriber URLs.","Treat 409 as idempotent success."],"exampleFix":"// before\nawait api.createTeamEventTypeWebhook(eventTypeId, { subscriberUrl, ... });\n// after\nconst list = await api.listTeamEventTypeWebhooks(eventTypeId);\nif (list.find(w => w.subscriberUrl === subscriberUrl)) return;\nawait api.createTeamEventTypeWebhook(eventTypeId, { subscriberUrl, ... });","handlingStrategy":"validation","validationCode":"async function createIfMissingTeamEventType(api, eventTypeId, body) {\n  const list = await api.getTeamEventTypeWebhooksPaginated(eventTypeId, 0, 1000);\n  if (list.find(w => w.subscriberUrl === body.subscriberUrl)) return;\n  return api.createTeamEventTypeWebhook(eventTypeId, body);\n}","typeGuard":"const isDuplicateUrl = (list: { subscriberUrl: string }[], url: string): boolean =>\n  list.some(w => w.subscriberUrl === url);","tryCatchPattern":"try { await api.createTeamEventTypeWebhook(eventTypeId, body); }\ncatch (e) { if (e.status === 409) return; else throw e; }","preventionTips":["List team event-type webhooks before creating.","Reuse unique subscriber URLs across team integrations.","Treat 409 as idempotent success."],"tags":["webhooks","conflict","duplicate","team","event-type"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}