gastownhall/beads · error

db: GetAdaptiveIDConfig: read min_hash_length: %w

Error message

db: GetAdaptiveIDConfig: read min_hash_length: %w

What it means

Same family as the other GetAdaptiveIDConfig wrappers: this one wraps a GetConfig(ctx, "min_hash_length") driver failure while loading the adaptive ID config. Unset keys are fine (defaults apply), so this error always indicates a database I/O problem, not bad data. Parse errors on the value are deliberately ignored.

Source

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

	if err != nil {
		return "", fmt.Errorf("db: GetAllowedPrefixes: %w", err)
	}
	return value, nil
}

func (r *configSQLRepositoryImpl) GetAdaptiveIDConfig(ctx context.Context) (domain.AdaptiveIDConfig, error) {
	cfg := domain.DefaultAdaptiveConfig()

	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) {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Unwrap with errors.Is to classify the cause.
  2. Restore connectivity and retry GetAdaptiveIDConfig.
  3. Increase context deadlines if cancellation is the cause.
  4. Verify config table accessibility on the server.
Defensive patterns

Strategy: fallback

Try / catch

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

Prevention

When it happens

Trigger: Calling GetAdaptiveIDConfig when the SELECT for the min_hash_length config row fails — connection drop, cancelled context, or server-side error — after max_collision_prob was read successfully.

Common situations: Flaky remote Dolt connections, mid-request cancellations, server failover between successive config reads in the same function.

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/51e5aeaca5933458. Report an issue: GitHub.