calcom/cal.diy · error · Error

no calendar id provided in createAttendees

Error message

no calendar id provided in createAttendees

What it means

Thrown by FeishuCalendarService.createAttendees (a private method called by createEvent after the event is created) when calendarId cannot be resolved from the destinationCalendar matching credentialId. Identical root cause to error 556, but reached after event creation — meaning a partially-created Feishu event will exist (createEvent catches this and calls deleteEvent to roll back).

Source

Thrown at packages/app-store/feishucalendar/lib/CalendarService.ts:184

        url: "",
        additionalInfo: {},
      };
    } catch (error) {
      this.log.error(error);
      await this.deleteEvent(eventId, event, calendarId);
      throw error;
    }
  }

  private createAttendees = async (event: CalendarEvent, eventId: string, credentialId: number) => {
    const mainHostDestinationCalendar = event.destinationCalendar
      ? event.destinationCalendar.find((cal) => cal.credentialId === credentialId) ??
        event.destinationCalendar[0]
      : undefined;
    const calendarId = mainHostDestinationCalendar?.externalId;
    if (!calendarId) {
      this.log.error("no calendar id provided in createAttendees");
      throw new Error("no calendar id provided in createAttendees");
    }
    const attendeeResponse = await this.fetcher(
      `/calendar/v4/calendars/${calendarId}/events/${eventId}/attendees/create_attendees`,
      {
        method: "POST",
        body: JSON.stringify({
          attendees: this.translateAttendees(event),
          need_notification: false,
        }),
      }
    );

    return handleFeishuError<CreateAttendeesResp>(attendeeResponse, this.log);
  };

  /**
   * @param uid
   * @param event

View on GitHub (pinned to 176037d0af)

Solutions

  1. Resolve createEvent's calendarId once and pass it into createAttendees instead of re-deriving (avoids divergence).
  2. Ensure destinationCalendar rows for all host credentials are populated before booking.
  3. Verify the rollback (deleteEvent) actually fires and cleans the orphan event — check logs.
  4. Surface the original error message (this.log.error already logs it) so the operator can see which credentialId failed.

Example fix

// before - re-derive calendarId, can diverge from createEvent
private createAttendees = async (event, eventId, credentialId) => {
  const mainHostDestinationCalendar = event.destinationCalendar?.find(c => c.credentialId === credentialId) ?? ...;
  const calendarId = mainHostDestinationCalendar?.externalId;
  if (!calendarId) throw new Error("no calendar id provided in createAttendees");
  ...
};

// after - accept the validated calendarId from createEvent
private createAttendees = async (event, eventId, calendarId: string) => {
  // calendarId already validated by caller
  const attendeeResponse = await this.fetcher(`/calendar/v4/calendars/${calendarId}/events/${eventId}/attendees/create_attendees`, ...);
};
Defensive patterns

Strategy: validation

Validate before calling

if (!calendarId) throw new Error("calendarId required for createAttendees");
// Pass the validated calendarId from createEvent into createAttendees.

Type guard

const hasCalendarId = (id: unknown): id is string => typeof id === "string" && id.length > 0;

Try / catch

if (!calendarId) {
  this.log.error("no calendar id provided in createAttendees", { credentialId });
  throw new Error(`Cannot create attendees: no calendar id for credential ${credentialId}`);
}

Prevention

When it happens

Trigger: Event created successfully, then createAttendees is invoked with a credentialId that matches no destinationCalendar entry, or destinationCalendar is undefined/empty. createEvent's catch block will then delete the just-created event.

Common situations: destinationCalendar list mutated between createEvent and createAttendees (rare); credentialId mismatch; destinationCalendar.externalId empty; race condition where destinationCalendar is being updated concurrently.

Related errors


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