{"record":{"id":"152280502ee0cc53","repo":"Kong/insomnia","slug":"no-oauth-2-0-access-tokens-found-for-request","errorCode":null,"errorMessage":"No OAuth 2.0 access tokens found for request","messagePattern":"No OAuth 2\\.0 access tokens found for request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/common/templating/local-template-tags.ts","lineNumber":976,"sourceCode":"          if (request.headers.length === 0) {\n            throw new Error('No headers available');\n          }\n\n          for (const header of request.headers) {\n            const headerName = await context.util.render(header.name);\n            headerName && headerNames.push(headerName);\n            if (headerName?.toLowerCase() === name.toLowerCase()) {\n              return context.util.render(header.value);\n            }\n          }\n\n          const headerNamesStr = headerNames.map(n => `\"${n}\"`).join(',\\n\\t');\n          throw new Error(`No header with name \"${name}\".\\nChoices are [\\n\\t${headerNamesStr}\\n]`);\n        }\n        if (attribute === 'oauth2' || attribute === 'oauth2-identity' || attribute === 'oauth2-refresh') {\n          const access = await context.util.models.oAuth2Token.getByRequestId(request._id);\n          if (!access || !access.accessToken) {\n            throw new Error('No OAuth 2.0 access tokens found for request');\n          }\n          if (attribute === 'oauth2') {\n            return access.accessToken;\n          }\n          if (attribute === 'oauth2-identity') {\n            return access.identityToken;\n          }\n          if (attribute === 'oauth2-refresh') {\n            return access.refreshToken;\n          }\n        }\n        if (attribute === 'name') {\n          return request.name;\n        }\n        if (attribute === 'folder') {\n          const ancestors = await context.util.models.request.getAncestors(request);\n          const doc = ancestors[folderIndex || 0];\n          if (!doc) {","sourceCodeStart":958,"sourceCodeEnd":994,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/common/templating/local-template-tags.ts#L958-L994","documentation":"Error \"No OAuth 2.0 access tokens found for request\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia/src/common/templating/local-template-tags.ts:976 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}