calcom/cal.diy · error · Error
get access token error
Error message
get access token error
What it means
Thrown by FeishuCalendarService.fetcher when this.auth.getToken() throws. The catch block discards the original error (a bare catch with no binding) and throws a generic 'get access token error', so the underlying cause — typically refreshAccessToken failure (error 554) or getAppAccessToken failure (errors 552/553) — is hidden from the caller.
Source
Thrown at packages/app-store/feishucalendar/lib/CalendarService.ts:121
},
data: {
key: newFeishuAuthCredentials,
},
});
return newFeishuAuthCredentials.access_token;
} catch (error) {
this.log.error("FeishuCalendarService refreshAccessToken error", error);
throw error;
}
};
private fetcher = async (endpoint: string, init?: RequestInit | undefined) => {
let accessToken = "";
try {
accessToken = await this.auth.getToken();
} catch {
throw new Error("get access token error");
}
return fetch(`${this.url}${endpoint}`, {
method: "GET",
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) ??View on GitHub (pinned to 176037d0af)
Solutions
- Inspect upstream Feishu logs to find the real token failure (the swallowed error is logged via this.log.error inside refreshAccessToken before propagation).
- Resolve the underlying cause: refresh token (554), app_ticket webhook (552), or app_ticket validity (553).
- Verify app_id/app_secret and that the Feishu app is published/approved.
- Re-throw with the original cause preserved so callers can distinguish token failure from API failure.
Example fix
// before - swallows cause
try {
accessToken = await this.auth.getToken();
} catch {
throw new Error("get access token error");
}
// after - preserve cause
try {
accessToken = await this.auth.getToken();
} catch (err) {
throw new Error("Unable to obtain Feishu access token", { cause: err });
} Defensive patterns
Strategy: try-catch
Validate before calling
try { await this.auth.getToken(); } catch { /* will surface as 'get access token error' */ } Type guard
const canGetToken = async (auth: { getToken: () => Promise<string> }): Promise<boolean> => {
try { await auth.getToken(); return true; } catch { return false; }
}; Try / catch
try {
await calendarService.createEvent(event, credentialId);
} catch (err) {
if (err instanceof Error && /get access token error/i.test(err.message)) {
// upstream token refresh failed; check Feishu credential health
logger.error("Feishu token acquisition failed for credential", credentialId);
}
throw err;
} Prevention
- Resolve the upstream token error (errors 552/553/554) first.
- Patch fetcher to preserve cause so the real failure is visible.
- Health-check Feishu credentials on a schedule.
When it happens
Trigger: Any fetcher call (createEvent, updateEvent, deleteEvent, createAttendees, availability lookups) when getToken rejects: refresh token expired, app_ticket missing, app_access_token fetch failed, or network error during token refresh.
Common situations: Feishu credential expired (see 554); Feishu app_ticket not delivered (see 552); Feishu returned 10012 (see 553); transient network failure during refresh; app keys misconfigured.
Related errors
- No app ticket found
- Feishu Calendar refresh token expired
- PermissionsGuard - no oAuth client found for access token=${
- ApiAuthStrategy - access token - Invalid Access Token.
- ApiAuthStrategy - access token - Invalid Access Token.. No o
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/7a4110c22d9f78f2.
Report an issue: GitHub.