Skip to content

bd import fails with duplicate primary key when importing existing JSONL into Dolt workspace #1934

@davidste

Description

@davidste

Summary

bd import -i .beads/issues.jsonl fails on a normal existing Dolt workspace with:

Import failed: failed to insert issue <id>: Error 1062: duplicate primary key given: [<id>]

This breaks both direct import and hook-driven import flows (bd hook post-merge / post-checkout) because those paths import into already-populated DBs.

Version

  • bd version 0.55.4 (Homebrew: v0.55.4@Homebrew)
  • macOS arm64

Minimal Repro

tmpdir=$(mktemp -d)
cd "$tmpdir"
git init -q
bd init --quiet --prefix test
bd create "repro issue" -p 1
bd sync
bd import -i .beads/issues.jsonl --json

Actual

Import failed: failed to insert issue test-3vo: Error 1062: duplicate primary key given: [test-3vo]

Expected

Import should be idempotent for existing IDs (update/no-op), not fail on PK collisions.

Extra Context

In our production repo, this surfaces as repeated warnings from hook flows:

Warning: could not import JSONL: failed to insert issue compound-07t: Error 1062: duplicate primary key given: [compound-07t]

Likely Cause

In cmd/bd/import_shared.go, importIssuesCore calls CreateIssuesWithFullOptions directly, and that appears create-only rather than update/upsert semantics for existing IDs.

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