From a689c66f776005bc6eea606137f9b1ce5fdc5ad5 Mon Sep 17 00:00:00 2001 From: Joshua Park <11261716+jparkypark@users.noreply.github.com> Date: Wed, 22 Oct 2025 17:50:05 -0500 Subject: [PATCH] Fix nil pointer dereference crash in bd sync command (#108) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sync command was crashing at sync.go:245 with a nil pointer dereference when running in direct mode (without daemon). The exportToJSONL function attempted to use store.SearchIssues() without first ensuring the store was initialized. This fix adds a call to ensureStoreActive() before accessing the store, matching the pattern used by other commands like export. This ensures the store is properly initialized whether running with or without the daemon. Fixes #106 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude --- cmd/bd/sync.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/bd/sync.go b/cmd/bd/sync.go index 0c27eef9..00af00cc 100644 --- a/cmd/bd/sync.go +++ b/cmd/bd/sync.go @@ -258,6 +258,11 @@ func exportToJSONL(ctx context.Context, jsonlPath string) error { } // Direct mode: access store directly + // Ensure store is initialized + if err := ensureStoreActive(); err != nil { + return fmt.Errorf("failed to initialize store: %w", err) + } + // Get all issues issues, err := store.SearchIssues(ctx, "", types.IssueFilter{}) if err != nil {