gastownhall/beads · error

open unit of work: %w

Error message

open unit of work: %w

What it means

openProxiedListUOW opens a unit of work via the proxied-server UOW provider; this wraps any provider.NewUOW error. When running against a daemon (proxied mode), list-family commands need this UOW to query storage remotely. A nil provider yields a distinct 'not initialized' error; this one means the open itself failed.

Source

Thrown at cmd/bd/list_proxied_server.go:46

	case in.watchMode:
		return runListProxiedWatch(cmd, ctx, in)
	case !in.ReadyFlag && in.prettyFormat && in.ParentID != "":
		return runListProxiedTree(ctx, in)
	default:
		// The --ready arm is not a case of its own any more: it is
		// ListRequest.ReadyFlag, and choosing the ready query from it is the
		// ROLE's job on both routes.
		return runListProxiedPage(ctx, out, in)
	}
}

func openProxiedListUOW(ctx context.Context) (uow.UnitOfWork, error) {
	if uowProvider == nil {
		return nil, errors.New("proxied-server UOW provider not initialized")
	}
	uw, err := uowProvider.NewUOW(ctx)
	if err != nil {
		return nil, fmt.Errorf("open unit of work: %w", err)
	}
	return uw, nil
}

// runListProxiedTree serves the ONE mode that is deliberately off the role: the
// hierarchical --parent walk under pretty output. It consumes the FILTER as a
// value, re-parenting a copy of it at every level, and it reaches no page
// epilogue on either route.
func runListProxiedTree(ctx context.Context, in listInput) error {
	uw, filter, err := openAndPrepare(ctx, in)
	if err != nil {
		return err
	}
	defer uw.Close(ctx)

	if in.Offset > 0 {
		return fmt.Errorf("--offset is not supported with hierarchical --parent + pretty/tree")
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the daemon is running: `bd doctor` or restart it (e.g. `bd daemon start` / let bd auto-spawn)
  2. Retry the command — transient connection failures often resolve
  3. Verify server connectivity/config (BD_HOST/remote settings) if using a remote daemon
  4. Fall back to direct (non-proxied) mode if your setup allows it
Defensive patterns

Strategy: retry

Validate before calling

// Check daemon availability before batch scripts
bd doctor >/dev/null 2>&1 || { echo "bd daemon/storage unhealthy"; exit 1; }

Try / catch

// Retry transient UOW open failures with backoff
for i in 1 2 3; do
  bd list --status open && break
  sleep $((i*i))
done

Prevention

When it happens

Trigger: Any proxied-server list-family command (list, duplicates, epic-status, close-eligible-epics, find-duplicates, graph) calling openProxiedListUOW when uowProvider.NewUOW(ctx) errors — typically daemon connection or session failure.

Common situations: bd daemon not running or crashed, stale socket after daemon restart, network/transport errors to the remote server, or Dolt server unavailability in proxied setups.

Related errors


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