calcom/cal.diy · error · Error
no calendar id
Error message
no calendar id
What it means
Thrown by FeishuCalendarService.createEvent when no calendarId can be resolved. The handler looks up the host's destinationCalendar (matching by credentialId, falling back to the first entry) and reads its externalId; if the user has no destinationCalendar or its externalId is empty, the event cannot be created in Feishu.
Source
Thrown at packages/app-store/feishucalendar/lib/CalendarService.ts:144
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
...init?.headers,
},
...init,
});
};
async createEvent(event: CalendarServiceEvent, credentialId: number): Promise<NewCalendarEventType> {
let eventId = "";
let eventRespData;
const mainHostDestinationCalendar = event.destinationCalendar
? event.destinationCalendar.find((cal) => cal.credentialId === this.credential.id) ??
event.destinationCalendar[0]
: undefined;
const calendarId = mainHostDestinationCalendar?.externalId;
if (!calendarId) {
throw new Error("no calendar id");
}
try {
const eventResponse = await this.fetcher(`/calendar/v4/calendars/${calendarId}/events/create_event`, {
method: "POST",
body: JSON.stringify(this.translateEvent(event)),
});
eventRespData = await handleFeishuError<CreateEventResp>(eventResponse, this.log);
eventId = eventRespData.data.event.event_id as string;
} catch (error) {
this.log.error(error);
throw error;
}
try {
await this.createAttendees(event, eventId, credentialId);
return {
...eventRespData,
uid: eventRespData.data.event.event_id as string,View on GitHub (pinned to 176037d0af)
Solutions
- Ensure each host with a Feishu credential has a destinationCalendar with a non-empty externalId (the Feishu primary calendar id).
- Re-trigger the calendar selection / destinationCalendar setup for the affected user.
- Verify the credentialId used in destinationCalendar matches an installed Feishu credential.
- Surface a user-facing message instead of throwing when destinationCalendar is absent.
Example fix
// before
const calendarId = mainHostDestinationCalendar?.externalId;
if (!calendarId) {
throw new Error("no calendar id");
}
// after - descriptive, actionable
if (!calendarId) {
throw new Error(`No Feishu calendar id resolved for credential ${this.credential.id}. Set a destination calendar in user settings.`);
} Defensive patterns
Strategy: validation
Validate before calling
const destCal = event.destinationCalendar?.find((c) => c.credentialId === this.credential.id) ?? event.destinationCalendar?.[0];
if (!destCal?.externalId) {
throw new Error(`No Feishu destination calendar set for credential ${this.credential.id}`);
} Type guard
const hasDestinationCalendar = (event: CalendarServiceEvent, credentialId: number): boolean => Array.isArray(event.destinationCalendar) && event.destinationCalendar.some((c) => typeof c.externalId === "string" && c.externalId.length > 0);
Try / catch
if (!calendarId) {
// surface user-actionable error
throw new Error("Select a Feishu calendar in user settings before booking.");
} Prevention
- Require a destinationCalendar before enabling Feishu as a booking calendar.
- Validate destinationCalendar.externalId presence in the booking preflight.
- Surface missing-calendar as a user-facing message, not a 500.
When it happens
Trigger: Booking created for a user whose Feishu calendar integration is connected but who has no destinationCalendar row (externalId) set; destinationCalendar exists but externalId is empty; the credentialId in destinationCalendar does not match any connected calendar.
Common situations: User connected Feishu but never selected a primary calendar; event.destinationCalendar array is undefined for managed/teams bookings; destinationCalendar.externalId got cleared by a sync bug.
Related errors
- no calendar id provided in createAttendees
- no calendar id provided in updateEvent
- no calendar id provided in deleteEvent
- Booking with uid ${bookingUid} not found
- Listed cals and URLs mismatch: ${listedCals.length} vs. ${ur
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/626f722efac1d991.
Report an issue: GitHub.