Skip to content

build/update crashes with 'cannot start a transaction within a transaction' when files are deleted #406

@gfleg77

Description

@gfleg77

Version: 2.3.2
Platform: Any (confirmed on Windows)

Reproduction

  1. Build a graph for a project
  2. Delete any tracked source file
  3. Run code-review-graph build . or code-review-graph update .

Result:

sqlite3.OperationalError: cannot start a transaction within a transaction

Root cause

GraphStore.remove_file_data issues DELETE statements without committing. Python sqlite3's default isolation_level="" opens an implicit transaction on the first DML statement. The subsequent parallel-parse loop then issues BEGIN IMMEDIATE — SQLite rejects it because a transaction is already open.

Fix

Add store.commit() after the stale-removal loops in both full_build and incremental_update in incremental.py. The watcher path (~line 603) already does this correctly and is the reference pattern:

# after stale file removal loop
if removed_any:
    store.commit()

Apply the same pattern to full_build (~line 360) and incremental_update (~line 485).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions