Kong/insomnia · error

Failed to get latest commit for all documents

Error message

Failed to get latest commit for all documents

What it means

Guard in VCS.allDocuments: no latest snapshot/commit exists on the current branch, so there is no committed state from which to collect all document blobs. Typically means the project has no commits yet or local VCS history is empty/corrupted.

Solutions

  1. Create an initial commit/snapshot on the branch
  2. Verify the correct branch is checked out
  3. Restore history from the remote via fetch/pull
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    errorMsg: string,
  ): Promise<MergeConflict[]> {
    if (conflicts.length === 0) {
      return conflicts;
    }

    if (!this._conflictHandler) {
      throw new Error(errorMsg);
    }

    return this._conflictHandler(conflicts, labels);
  }

  async allDocuments(): Promise<Record<string, any>> {
    const branch = await this._getCurrentBranch();
    const snapshot: Snapshot | null = await this._getLatestSnapshot(branch.name);

    if (!snapshot) {
      throw new Error('Failed to get latest commit for all documents');
    }
    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);

View on GitHub (pinned to d9bb2b0142)