calcom/cal.diy · error · InternalServerErrorException
Could not get oAuthClient
Error message
Could not get oAuthClient
What it means
InternalServerErrorException('Could not get oAuthClient') from AtomsOAuth2Controller.getClient — the fallback when oAuthService.getClient(clientId) rejects with something that is NOT an ErrorWithCode (a plain Error, a TypeError, a Prisma error, etc.). The original error is logged via this.logger.error(err) before the generic 500 is returned, so the real cause is in server logs, not the response.
Solutions
- Inspect server logs (this.logger.error output) for the original error stack — the 500 response intentionally hides it.
- If the cause is a DB/connectivity issue, restore database connectivity and retry.
- As a platform maintainer: ensure getClient wraps all failure modes in ErrorWithCode so callers receive a meaningful status instead of a 500.
- Check that Prisma/DATABASE_URL is correctly configured for this environment.
Defensive patterns
Strategy: retry
Type guard
function isUnexpectedError(e: unknown): boolean {
return !(e instanceof ErrorWithCode);
} Try / catch
try {
await api.get(`/v2/atoms/oauth/clients/${clientId}`);
} catch (e) {
if (e.response?.status === 500) {
// inspect server logs; retry once after a short backoff if transient
await backoff();
return api.get(`/v2/atoms/oauth/clients/${clientId}`);
}
throw e;
} Prevention
- Monitor server logs for the original this.logger.error output — the response hides it.
- Ensure DB connectivity (DATABASE_URL) and that Prisma is healthy.
- As maintainer: wrap all getClient failure modes in ErrorWithCode to remove opaque 500s.
When it happens
Trigger: GET to the atoms OAuth client info endpoint when getClient throws a non-ErrorWithCode exception — e.g. a database connection failure, a null-dereference, a Prisma internal error, or any unhandled runtime error inside the service.
Common situations: Database is down or unreachable; Prisma query timed out; null reference inside getClient; a dependency threw a plain Error instead of an ErrorWithCode; transient network issue to the DB.
Related errors
- ${err.message}
- ${error.message}
- An unexpected error occurred while deleting the selected…
- ApiAuthStrategy - access token - Invalid Access Token.
- ApiAuthStrategy - access token - Invalid Access Token.. No…
AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12).
Data as JSON: /api/errors/8ef9ccd6f7ba09a6.
Report an issue: GitHub.
Appendix: source
Thrown at apps/api/v2/src/modules/auth/oauth2/controllers/atoms-oauth2.controller.ts:53
throw new NotFoundException();
}
try {
const client = await this.oAuthService.getClient(clientId);
return {
status: SUCCESS_STATUS,
data: {
clientId: client.clientId,
organizationId: null,
},
};
} catch (err: unknown) {
if (err instanceof ErrorWithCode) {
const statusCode = getHttpStatusCode(err);
throw new HttpException(err.message, statusCode);
}
this.logger.error(err);
throw new InternalServerErrorException("Could not get oAuthClient");
}
}
}
View on GitHub (pinned to 176037d0af)