Kong/insomnia · error

More than one backend project matched query

Error message

More than one backend project matched query

What it means

Ambiguity guard in VCS._getBackendProjectByRootDocument: after pruning empty projects, more than one backend project still matches the root document id — the 1:1 mapping between root document and backend project is violated.

Solutions

  1. Inspect local storage and delete the stale duplicate backend project entries
  2. Re-sync or re-create the project if duplicates cannot be resolved
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

      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}`);
        }
      }
    }

    // If there are still too many, error out
    if (matchedBackendProjects.length > 1) {
      console.log('[sync] Multiple backend projects matched for root', {
        backendProjects,
        matchedBackendProjects,
        rootDocumentId,
      });
      throw new Error('More than one backend project matched query');
    }

    return matchedBackendProjects[0] || null;
  }

  async _getOrCreateBackendProjectByRootDocument(rootDocumentId: string, name: string) {
    let project: BackendProject | null = await this._getBackendProjectByRootDocument(rootDocumentId);

    // If we still don't have a project, create one
    if (!project) {
      const id = generateId('prj');
      project = {
        id,
        name,
        rootDocumentId,
      };
      await this._storeBackendProject(project);
      console.log(`[sync] Created backend project ${project.id}`);

View on GitHub (pinned to d9bb2b0142)