gastownhall/beads · error

LoadCreateContext: read infra types: %w

Error message

LoadCreateContext: read infra types: %w

What it means

Wrapping error from ConfigUseCaseImpl.LoadCreateContext at internal/storage/domain/config.go:265. Raised when u.GetInfraTypes(ctx) fails — the final read before returning the CreateContext struct. Note this read goes through the use case itself (GetInfraTypes) rather than directly through the repo, so the wrapped cause may itself be another use-case-level error.

Source

Thrown at internal/storage/domain/config.go:265

	prefix, err := u.cfgRepo.GetConfig(ctx, "issue_prefix")
	if err != nil {
		return CreateContext{}, fmt.Errorf("LoadCreateContext: read issue_prefix: %w", err)
	}
	allowed, err := u.cfgRepo.GetAllowedPrefixes(ctx)
	if err != nil {
		return CreateContext{}, fmt.Errorf("LoadCreateContext: read allowed_prefixes: %w", err)
	}
	customTypes, err := u.cfgRepo.GetCustomTypes(ctx)
	if err != nil {
		return CreateContext{}, fmt.Errorf("LoadCreateContext: read custom types: %w", err)
	}
	customStatuses, err := u.cfgRepo.GetCustomStatuses(ctx)
	if err != nil {
		return CreateContext{}, fmt.Errorf("LoadCreateContext: read custom statuses: %w", err)
	}
	infraTypes, err := u.GetInfraTypes(ctx)
	if err != nil {
		return CreateContext{}, fmt.Errorf("LoadCreateContext: read infra types: %w", err)
	}
	return CreateContext{
		IssuePrefix:     prefix,
		AllowedPrefixes: allowed,
		CustomTypes:     customTypes,
		CustomStatuses:  customStatuses,
		InfraTypes:      infraTypes,
	}, nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Unwrap to find the storage-level cause
  2. Verify infra-type config tables exist (check for schema/migration gaps)
  3. Confirm the GetInfraTypes path itself is healthy (test it directly)
  4. Retry once storage is healthy
Defensive patterns

Strategy: try-catch

Validate before calling

// verify infra types are readable before create flows
if _, err := uc.GetInfraTypes(ctx); err != nil {
	return fmt.Errorf("infra types unreadable, check schema: %w", err)
}

Try / catch

cc, err := uc.LoadCreateContext(ctx)
if err != nil && strings.Contains(err.Error(), "read infra types") {
	if isMissingTableErr(errors.Unwrap(err)) {
		runMigrations() // create missing infra-type tables
		cc, err = uc.LoadCreateContext(ctx)
	}
	return err
}
return nil

Prevention

When it happens

Trigger: Calling LoadCreateContext when GetInfraTypes fails — underlying repository error reading infra-type configuration, connection failure, or cancelled context on the last leg of the multi-read sequence.

Common situations: Infra types feature enabled but its config store missing/corrupted; transient DB failure at the end of a long read sequence; version mismatch where infra-type tables don't exist yet.

Related errors


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