Kong/insomnia · error
No OAuth 2.0 access tokens found for request
Error message
No OAuth 2.0 access tokens found for request
What it means
Template-tag runtime error for {% request 'oauth2' ... %} attribute lookups: the referenced request has OAuth2 tokens configured at the access level but no access token value is present, so the tag has nothing to return.
Solutions
- Send the request once with OAuth 2.0 auth to obtain a token
- Check the OAuth 2.0 configuration (token URL, client credentials)
- Trigger token fetch manually via the auth options
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:976 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26).
Data as JSON: /api/errors/152280502ee0cc53.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:976
if (request.headers.length === 0) {
throw new Error('No headers available');
}
for (const header of request.headers) {
const headerName = await context.util.render(header.name);
headerName && headerNames.push(headerName);
if (headerName?.toLowerCase() === name.toLowerCase()) {
return context.util.render(header.value);
}
}
const headerNamesStr = headerNames.map(n => `"${n}"`).join(',\n\t');
throw new Error(`No header with name "${name}".\nChoices are [\n\t${headerNamesStr}\n]`);
}
if (attribute === 'oauth2' || attribute === 'oauth2-identity' || attribute === 'oauth2-refresh') {
const access = await context.util.models.oAuth2Token.getByRequestId(request._id);
if (!access || !access.accessToken) {
throw new Error('No OAuth 2.0 access tokens found for request');
}
if (attribute === 'oauth2') {
return access.accessToken;
}
if (attribute === 'oauth2-identity') {
return access.identityToken;
}
if (attribute === 'oauth2-refresh') {
return access.refreshToken;
}
}
if (attribute === 'name') {
return request.name;
}
if (attribute === 'folder') {
const ancestors = await context.util.models.request.getAncestors(request);
const doc = ancestors[folderIndex || 0];
if (!doc) {View on GitHub (pinned to d9bb2b0142)