Kong/insomnia · error

Failed to initiate the GitHub OAuth flow: ${errorMessage}

Error message

Failed to initiate the GitHub OAuth flow: ${errorMessage}

What it means

Error "Failed to initiate the GitHub OAuth flow: ${errorMessage}" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/sync/git/providers/github.ts:285

    try {
      const state = v4();
      githubStatesCache.set(state, credentialId);
      const url = new URL(getAppWebsiteBaseURL() + '/oauth/github-app');

      url.search = new URLSearchParams({
        state,
      }).toString();

      await shell.openExternal(url.toString());

      return {
        authUrl: url.toString(),
        state,
      };
    } catch (error) {
      const errorMessage = error instanceof Error ? error.message : String(error);
      console.error('Failed to initiate the GitHub OAuth flow:', error);
      throw new Error(`Failed to initiate the GitHub OAuth flow: ${errorMessage}`);
    }
  }

  /**
   * Complete OAuth flow
   * Exchanges code for token and creates/updates credential in database
   */
  async completeOAuth(code: string, state: string): Promise<OAuthCompleteResult> {
    try {
      // Validate state for security (CSRF protection)
      if (!PLAYWRIGHT_TEST && !githubStatesCache.has(state)) {
        throw new Error('Invalid state parameter. It looks like the authorization flow was not initiated by the app.');
      }
      const reauthorizingCredentialId = githubStatesCache.get(state);

      // Exchange code for access token via Insomnia backend
      const response = await net.fetch(getApiBaseURL() + '/v1/oauth/github-app', {
        method: 'POST',

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/sync/git/providers/github.ts:285 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/12451a33e273430d. Report an issue: GitHub.