gastownhall/beads · error

db: GetAdaptiveIDConfig: read max_hash_length: %w

Error message

db: GetAdaptiveIDConfig: read max_hash_length: %w

What it means

This error wraps a GetConfig(ctx, "max_hash_length") driver failure in GetAdaptiveIDConfig, the third sequential config read in that function. Like its siblings, it fires only on database I/O failures; an absent key leaves cfg.MaxLength at its default and unparsable values are ignored silently.

Source

Thrown at internal/storage/domain/db/config.go:233

	if probStr, err := r.GetConfig(ctx, "max_collision_prob"); err != nil {
		return cfg, fmt.Errorf("db: GetAdaptiveIDConfig: read max_collision_prob: %w", err)
	} else if probStr != "" {
		if prob, perr := strconv.ParseFloat(probStr, 64); perr == nil {
			cfg.MaxCollisionProbability = prob
		}
	}

	if minStr, err := r.GetConfig(ctx, "min_hash_length"); err != nil {
		return cfg, fmt.Errorf("db: GetAdaptiveIDConfig: read min_hash_length: %w", err)
	} else if minStr != "" {
		if v, perr := strconv.Atoi(minStr); perr == nil {
			cfg.MinLength = v
		}
	}

	if maxStr, err := r.GetConfig(ctx, "max_hash_length"); err != nil {
		return cfg, fmt.Errorf("db: GetAdaptiveIDConfig: read max_hash_length: %w", err)
	} else if maxStr != "" {
		if v, perr := strconv.Atoi(maxStr); perr == nil {
			cfg.MaxLength = v
		}
	}

	return cfg, nil
}

func (r *configSQLRepositoryImpl) GetCustomStatuses(ctx context.Context) ([]types.CustomStatus, error) {
	return issueops.ResolveCustomStatusesDetailedInTx(ctx, r.runner)
}

func (r *configSQLRepositoryImpl) ListAllStatusNames(ctx context.Context) ([]string, error) {
	builtins := []types.Status{
		types.StatusOpen, types.StatusInProgress, types.StatusBlocked,
		types.StatusDeferred, types.StatusClosed, types.StatusPinned, types.StatusHooked,
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Unwrap the error to see the driver cause.
  2. Reconnect and retry the config load.
  3. Extend context timeouts so all three sequential reads fit within the deadline.
  4. Check server logs for config-table query errors.
Defensive patterns

Strategy: fallback

Try / catch

cfg, err := store.GetAdaptiveIDConfig(ctx)
if err != nil {
    log.Printf("adaptive config unavailable (%v); applying defaults", err)
    cfg = domain.DefaultAdaptiveConfig()
}

Prevention

When it happens

Trigger: Calling GetAdaptiveIDConfig when the SELECT for max_hash_length fails due to connection loss, context cancellation, or a server error on the config table.

Common situations: Connection resets during multi-read config loading, per-query deadlines expiring partway through GetAdaptiveIDConfig, Dolt server restarts.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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