gastownhall/beads · error

dry-run: %w

Error message

dry-run: %w

What it means

`bd import --dry-run` first classifies what the import would create/update via classifyDryRunImport; if that classification call fails, the error is wrapped as `dry-run: ...`. The actual root cause is inside the classifier (typically a store or validation failure).

Source

Thrown at cmd/bd/import.go:324

	// Dedup: skip issues whose title matches an existing open issue
	dedupHits := 0
	if importDedup && len(issues) > 0 {
		issues, dedupHits = filterDuplicatesByTitle(ctx, store, issues)
	}

	result := importResultJSON{
		Source:    source,
		DedupHits: dedupHits,
		DryRun:    importDryRun,
	}

	if importDryRun {
		result.Memories = len(memories)
		result.Skipped = dedupHits

		classification, err := classifyDryRunImport(ctx, store, issues, importAllowStale)
		if err != nil {
			return fmt.Errorf("dry-run: %w", err)
		}
		applyImportDryRunClassification(&result, classification)
		return renderImportDryRun(result, len(memories), source, dedupHits)
	}

	// Import memories
	for _, mem := range memories {
		storageKey := kvPrefix + memoryPrefix + mem.Key
		if err := store.SetConfig(ctx, storageKey, mem.Value); err != nil {
			return fmt.Errorf("failed to import memory %q: %w", mem.Key, err)
		}
		result.Memories++
	}

	// Import issues
	if len(issues) > 0 {
		opts := ImportOptions{SkipPrefixValidation: true, AllowStale: importAllowStale}
		importResult, err := importIssuesCore(ctx, "", store, issues, opts)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped inner error after `dry-run:` for the real cause
  2. Run `bd doctor` to check database health and locks
  3. Retry with `--allow-stale` if staleness validation is the blocker and you accept stale records
  4. Re-run after closing other bd processes holding the database

Example fix

// before
bd import --dry-run data.jsonl   # dry-run: prefix validation failed
// after
bd import --dry-run --allow-stale data.jsonl
Defensive patterns

Strategy: try-catch

Validate before calling

bd doctor   # confirm store health before --dry-run
bd import --dry-run data.jsonl

Try / catch

if ! bd import --dry-run data.jsonl 2>err.log; then
  grep -o 'dry-run: .*' err.log   # inspect inner classification cause
fi

Prevention

When it happens

Trigger: Running `bd import --dry-run file.jsonl` where classifyDryRunImport hits a store error — closed/nil store handle, database locked, or prefix/staleness validation blowing up on the candidate issues.

Common situations: Dry-run against a database opened by another process with a conflicting lock; issues referencing prefixes not configured locally; stale imports attempted without --allow-stale.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/9d2d8362865425e5. Report an issue: GitHub.