gastownhall/beads · error

load infra types: %w

Error message

load infra types: %w

What it means

LoadListConfig builds the ListConfig used by list filtering. As part of that it fetches the set of infra types from the ConfigSource (store or unit-of-work). When that fetch fails, the underlying error (storage/connection/interceptor failure) is wrapped as 'load infra types: %w' so callers know which config step failed.

Source

Thrown at internal/workapi/list.go:159

	statuses, err := src.GetCustomStatuses(ctx)
	if err != nil {
		return cfg, fmt.Errorf("load custom statuses: %w", err)
	}
	cfg.CustomStatuses = statuses

	ct, err := src.GetCustomTypes(ctx)
	if err != nil {
		return cfg, fmt.Errorf("load custom types: %w", err)
	}
	if len(ct) > 0 {
		cfg.CustomTypes = ct
	} else {
		cfg.CustomTypes = config.GetCustomTypesFromYAML()
	}

	infraSet, err := src.GetInfraTypes(ctx)
	if err != nil {
		return cfg, fmt.Errorf("load infra types: %w", err)
	}
	if len(infraSet) > 0 {
		cfg.InfraSet = infraSet
	}

	return cfg, nil
}

// LoadStoreListConfig loads the list configuration from a store handle. A nil
// store (no workspace open) still yields the YAML custom types.
func LoadStoreListConfig(ctx context.Context, store storage.DoltStorage) (ListConfig, error) {
	if store == nil {
		return ListConfig{CustomTypes: config.GetCustomTypesFromYAML()}, nil
	}
	return LoadListConfig(ctx, NewStoreConfigSource(store))
}

// LoadUOWListConfig loads the list configuration through an open unit of work.

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped error (%w) for the root cause — usually a storage/connection failure
  2. Verify the workspace/store is opened and reachable before calling Load*ListConfig
  3. Retry the load if the underlying failure is transient
  4. If a nil store is acceptable in your flow, use LoadStoreListConfig which handles nil by returning YAML-only config

Example fix

// before
cfg, err := workapi.LoadUOWListConfig(ctx, uw)
// after
cfg, err := workapi.LoadUOWListConfig(ctx, uw)
if err != nil {
    var storeErr *storage.ConnectError
    if errors.As(err, &storeErr) { /* reopen store, retry */ }
    return err
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure store is reachable before loading config
if store == nil {
    return ListConfig{CustomTypes: config.GetCustomTypesFromYAML()}, nil
}
if err := store.Ping(ctx); err != nil {
    return fmt.Errorf("store unavailable: %w", err)
}

Type guard

func storeReady(s storage.DoltStorage) bool { return s != nil }

Try / catch

cfg, err := workapi.LoadStoreListConfig(ctx, store)
if err != nil {
    return fmt.Errorf("cannot load list config: %w", err)
}

Prevention

When it happens

Trigger: Calling LoadStoreListConfig or LoadUOWListConfig (or LoadListConfig directly) when the underlying ConfigSource.GetInfraTypes call errors — e.g. the store/db connection is unavailable or the config-usecase query fails.

Common situations: Database not reachable or corrupt when opening a workspace; calling list helpers without an initialized store/UOW; transient storage failures during 'bd list' startup.

Related errors


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