{"record":{"id":"51e5aeaca5933458","repo":"gastownhall/beads","slug":"db-getadaptiveidconfig-read-min-hash-length-w","errorCode":null,"errorMessage":"db: GetAdaptiveIDConfig: read min_hash_length: %w","messagePattern":"db: GetAdaptiveIDConfig: read min_hash_length: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/db/config.go","lineNumber":225,"sourceCode":"\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"db: GetAllowedPrefixes: %w\", err)\n\t}\n\treturn value, nil\n}\n\nfunc (r *configSQLRepositoryImpl) GetAdaptiveIDConfig(ctx context.Context) (domain.AdaptiveIDConfig, error) {\n\tcfg := domain.DefaultAdaptiveConfig()\n\n\tif probStr, err := r.GetConfig(ctx, \"max_collision_prob\"); err != nil {\n\t\treturn cfg, fmt.Errorf(\"db: GetAdaptiveIDConfig: read max_collision_prob: %w\", err)\n\t} else if probStr != \"\" {\n\t\tif prob, perr := strconv.ParseFloat(probStr, 64); perr == nil {\n\t\t\tcfg.MaxCollisionProbability = prob\n\t\t}\n\t}\n\n\tif minStr, err := r.GetConfig(ctx, \"min_hash_length\"); err != nil {\n\t\treturn cfg, fmt.Errorf(\"db: GetAdaptiveIDConfig: read min_hash_length: %w\", err)\n\t} else if minStr != \"\" {\n\t\tif v, perr := strconv.Atoi(minStr); perr == nil {\n\t\t\tcfg.MinLength = v\n\t\t}\n\t}\n\n\tif maxStr, err := r.GetConfig(ctx, \"max_hash_length\"); err != nil {\n\t\treturn cfg, fmt.Errorf(\"db: GetAdaptiveIDConfig: read max_hash_length: %w\", err)\n\t} else if maxStr != \"\" {\n\t\tif v, perr := strconv.Atoi(maxStr); perr == nil {\n\t\t\tcfg.MaxLength = v\n\t\t}\n\t}\n\n\treturn cfg, nil\n}\n\nfunc (r *configSQLRepositoryImpl) GetCustomStatuses(ctx context.Context) ([]types.CustomStatus, error) {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/db/config.go#L207-L243","documentation":"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.","triggerScenarios":"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.","commonSituations":"Flaky remote Dolt connections, mid-request cancellations, server failover between successive config reads in the same function.","solutions":["Unwrap with errors.Is to classify the cause.","Restore connectivity and retry GetAdaptiveIDConfig.","Increase context deadlines if cancellation is the cause.","Verify config table accessibility on the server."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"cfg, err := store.GetAdaptiveIDConfig(ctx)\nif err != nil {\n    log.Printf(\"adaptive config read failed (%v); using defaults\", err)\n    cfg = domain.DefaultAdaptiveConfig()\n}","preventionTips":["Prefer defaults over hard failure for tunable settings like min_hash_length.","Keep context deadlines long enough for the three sequential config reads.","Log wrapped errors for postmortems instead of silently swallowing them."],"tags":["database","config","adaptive-id"],"backgroundTag":"database-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}