Kong/insomnia · error

No root document ID supplied for backend project

Error message

No root document ID supplied for backend project

What it means

Argument guard in VCS._getBackendProjectByRootDocument: rootDocumentId is empty/falsy, so backend projects cannot be matched against their root document. The caller must supply the workspace/project root document id.

Solutions

  1. Supply the workspace/project root document id
  2. Verify the workspace is properly initialized before sync
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    const branch = await this._getBranch(name);

    if (branch === null) {
      await this._storeBranch({
        name,
        created: new Date(),
        modified: new Date(),
        snapshots: [],
      });
      return this._getOrCreateBranch(name);
    }

    return branch;
  }

  async _getBackendProjectByRootDocument(rootDocumentId: string) {
    if (!rootDocumentId) {
      throw new Error('No root document ID supplied for backend project');
    }

    // First, try finding the project
    const backendProjects = await this._allBackendProjects();
    let matchedBackendProjects = backendProjects.filter(p => p.rootDocumentId === rootDocumentId);

    // If there is more than one project for root, try pruning unused ones by branch activity
    if (matchedBackendProjects.length > 1) {
      for (const p of matchedBackendProjects) {
        const branches = await this._getBranches(p.id);

        if (!branches.find(b => b.snapshots.length > 0)) {
          await this._removeProject(p);
          matchedBackendProjects = matchedBackendProjects.filter(({ id }) => id !== p.id);
          console.log(`[sync] Remove inactive project for root ${rootDocumentId}`);
        }
      }
    }

View on GitHub (pinned to d9bb2b0142)