Kong/insomnia · error

Can't get private key: session is missing keys.

Error message

Can't get private key: session is missing keys.

What it means

Guard in VCS._getPrivateKey: session data exists but lacks symmetricKey or encPrivateKey, so the encrypted private key cannot be decrypted. Indicates a malformed or partial session record rather than simple logout.

Solutions

  1. Log out and log back in to regenerate session keys
  2. Clear the stale session from storage if logout is unavailable
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at packages/insomnia-vcs/src/vcs.ts:1401 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/e84e74ce53e2f140. Report an issue: GitHub.

Appendix: source

Thrown at packages/insomnia-vcs/src/vcs.ts:1401

      // use the session symmetric key in playwright tests
      return symmetricKey;
    }

    const encSymmetricKey = await this._queryBackendProjectKey();
    const symmetricKeyStr = crypt.decryptRSAWithJWK(privateKey, encSymmetricKey);
    return JSON.parse(symmetricKeyStr);
  }

  // TODO: This is a temporary solution to get the private key from the session.
  async _getPrivateKey(sessionData?: UserSession): Promise<JsonWebKey> {
    if (!sessionData) {
      throw new Error("Can't get private key: session is blank.");
    }

    const { symmetricKey, encPrivateKey } = sessionData;

    if (!symmetricKey || !encPrivateKey) {
      throw new Error("Can't get private key: session is missing keys.");
    }

    const privateKeyStr = await crypt.decryptAES(symmetricKey, encPrivateKey);
    return JSON.parse(privateKeyStr) as JsonWebKey;
  }

  async _assertBackendProject() {
    const project = await this._getBackendProject();

    if (project === null) {
      throw new Error('Failed to find local backend project id=' + this._backendProjectId());
    }

    return project;
  }

  async _storeBackendProject(project: BackendProject) {
    let existingProject: BackendProject | null = null;

View on GitHub (pinned to d9bb2b0142)