Kong/insomnia · error
No commits to rollback to
Error message
No commits to rollback to
What it means
rollbackToLatest found no snapshots on the current branch, meaning the branch has no commit history to restore to, so a rollback target cannot be determined.
Solutions
- Make at least one commit before rolling back
- Verify branch history exists (getHistoryCount) before calling rollbackToLatest
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/insomnia-vcs/src/vcs.ts:562 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/2ab12d26acba0aff.
Report an issue: GitHub.
Appendix: source
Thrown at packages/insomnia-vcs/src/vcs.ts:562
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);
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,
}));
View on GitHub (pinned to d9bb2b0142)