calcom/cal.diy · error · BadRequestException

DELEGATION_CREDENTIAL_ERROR trigger is only available for or

Error message

DELEGATION_CREDENTIAL_ERROR trigger is only available for organization webhooks

What it means

TeamEventTypeWebhooksService.createTeamEventTypeWebhook rejects DELEGATION_CREDENTIAL_ERROR in eventTriggers with BadRequestException (HTTP 400). Team event-type webhooks, like regular event-type webhooks, are not organization webhooks, so the trigger is forbidden. Identical logic to EventTypeWebhooksService.

Source

Thrown at apps/api/v2/src/modules/webhooks/services/team-event-type-webhooks.service.ts:15

import { WebhookTriggerEvents } from "@calcom/prisma/enums";
import { BadRequestException, ConflictException, Injectable } from "@nestjs/common";
import type { PipedInputWebhookType } from "@/modules/webhooks/pipes/WebhookInputPipe";
import { validateWebhookUrl } from "@/modules/webhooks/utils/validate-webhook-url";
import { WebhooksRepository } from "@/modules/webhooks/webhooks.repository";

@Injectable()
export class TeamEventTypeWebhooksService {
  constructor(private readonly webhooksRepository: WebhooksRepository) {}

  async createTeamEventTypeWebhook(eventTypeId: number, body: PipedInputWebhookType) {
    validateWebhookUrl(body.subscriberUrl);

    if (body.eventTriggers.includes(WebhookTriggerEvents.DELEGATION_CREDENTIAL_ERROR)) {
      throw new BadRequestException(
        "DELEGATION_CREDENTIAL_ERROR trigger is only available for organization webhooks"
      );
    }

    const existingWebhook = await this.webhooksRepository.getEventTypeWebhookByUrl(
      eventTypeId,
      body.subscriberUrl
    );
    if (existingWebhook) {
      throw new ConflictException("Webhook with this subscriber url already exists for this event type");
    }
    return this.webhooksRepository.createEventTypeWebhook(eventTypeId, {
      ...body,
      payloadTemplate: body.payloadTemplate ?? null,
      secret: body.secret ?? null,
    });
  }

View on GitHub (pinned to 176037d0af)

Solutions

  1. Drop DELEGATION_CREDENTIAL_ERROR from eventTriggers for team event-type webhooks.
  2. Use the organization-webhooks endpoint if you need that trigger.
  3. Scope-filter trigger options in the client UI.

Example fix

// before
body.eventTriggers = ['DELEGATION_CREDENTIAL_ERROR', 'BOOKING_CANCELLED'];
// after
body.eventTriggers = ['BOOKING_CANCELLED'];
Defensive patterns

Strategy: validation

Validate before calling

const ORG_ONLY_TRIGGERS = new Set(['DELEGATION_CREDENTIAL_ERROR']);
body.eventTriggers = body.eventTriggers.filter(t => !ORG_ONLY_TRIGGERS.has(t));

Type guard

const isOrgOnlyTrigger = (t: string): boolean => t === 'DELEGATION_CREDENTIAL_ERROR';

Try / catch

try { await api.createTeamEventTypeWebhook(eventTypeId, body); }
catch (e) {
  if (e.status === 400 && /DELEGATION_CREDENTIAL_ERROR/.test(e.message)) {
    body.eventTriggers = body.eventTriggers.filter(t => t !== 'DELEGATION_CREDENTIAL_ERROR');
  } else throw e;
}

Prevention

When it happens

Trigger: POSTing a team event-type webhook whose eventTriggers array contains DELEGATION_CREDENTIAL_ERROR.

Common situations: Reusing a trigger set from an organization webhook; UI surfacing triggers without scope awareness; copy-paste between scopes.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/5d7ef36eefc1ab43. Report an issue: GitHub.