Kong/insomnia · error

Failed to find commit by id

Error message

Failed to find commit by id ${snapshotId}

What it means

rollback was given a snapshotId that does not exist in the local VCS store, so the requested commit cannot be loaded for rollback.

Solutions

  1. List valid commit ids with getHistory and use one of them
  2. Pull latest history from the remote before rolling back
  3. Check the snapshot id for typos
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    return this._getBlobs(snapshot.state.map(s => s.blob));
  }

  async rollbackToLatest(candidates: StatusCandidate[]) {
    const branch = await this._getCurrentBranch();
    const latestSnapshot = await this._getLatestSnapshot(branch.name);

    if (!latestSnapshot) {
      throw new Error('No commits to rollback to');
    }

    return this.rollback(latestSnapshot.id, candidates);
  }

  async rollback(snapshotId: string, candidates: StatusCandidate[]) {
    const rollbackSnapshot: Snapshot | null = await this._getSnapshot(snapshotId);

    if (rollbackSnapshot === null) {
      throw new Error(`Failed to find commit by id ${snapshotId}`);
    }

    const currentState: SnapshotState = candidates.map(candidate => ({
      key: candidate.key,
      blob: hashDocument(candidate.document).hash,
      name: candidate.name,
    }));

    const delta = stateDelta(currentState, rollbackSnapshot.state);
    // We need to treat removals of candidates differently because they may not yet have been stored as blobs.
    const remove: StatusCandidate[] = [];

    for (const entry of delta.remove) {
      const candidate = candidates.find(candidate => candidate.key === entry.key);

      if (!candidate) {
        // Should never happen
        throw new Error('Failed to find removal in candidates');

View on GitHub (pinned to d9bb2b0142)