gastownhall/beads · error
server diagnostics failed: %w
Error message
server diagnostics failed: %w
What it means
runDoltServerDiagnostics (which opens a MySQL connection and runs diagnostic queries) failed; its error is wrapped with 'server diagnostics failed:'. The wrapped cause contains the actual problem (open, ping, or query failure).
Source
Thrown at cmd/bd/doctor/perf_dolt.go:95
// Start profiling if requested
if enableProfiling {
profilePath := fmt.Sprintf("beads-dolt-perf-%s.prof", time.Now().Format("2006-01-02-150405"))
if profileFile, err := startCPUProfile(profilePath); err != nil {
fmt.Fprintf(os.Stderr, "Warning: failed to start CPU profiling: %v\n", err)
} else {
metrics.ProfilePath = profilePath
defer stopCPUProfile(profileFile)
}
}
// Connect and run diagnostics via server
if !serverRunning {
return metrics, fmt.Errorf("dolt sql-server is not running on %s:%d; start it with 'bd dolt start'", dsCfg.Host, dsCfg.Port)
}
if err := runDoltServerDiagnostics(metrics, dsCfg.Host, dsCfg.Port, dbName, beadsDir); err != nil {
return metrics, fmt.Errorf("server diagnostics failed: %w", err)
}
// Calculate database size
metrics.DatabaseSize = getDoltDatabaseSize(doltDir)
return metrics, nil
}
// runDoltServerDiagnostics runs diagnostics via dolt sql-server
func runDoltServerDiagnostics(metrics *DoltPerfMetrics, host string, port int, dbName string, beadsDir string) error {
metrics.Backend = "dolt-server"
metrics.ServerMode = true
// Resolve credentials from config and environment, matching openDoltDB behavior.
// GetDoltServerPasswordForPort checks BEADS_DOLT_PASSWORD env first, then
// falls back to ~/.config/beads/credentials keyed by [host:port] — required
// for externally-hosted Dolt servers (bd-h5k7).
user := configfile.DefaultDoltServerUserView on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped %w cause for open/ping/query detail
- Confirm credentials and database name in the Dolt server config
- Check server logs for query errors; ensure the beads schema is up to date ('bd doctor', migrations)
Defensive patterns
Strategy: try-catch
Validate before calling
if !serverReachable(host, port) { return }
// also verify schema: SELECT 1 FROM issues LIMIT 1 succeeds Try / catch
if err != nil && strings.HasPrefix(err.Error(), "server diagnostics failed:") {
cause := errors.Unwrap(err)
log.Printf("dolt server diagnostics: %v", cause)
} Prevention
- Verify connectivity and auth before long diagnostic runs
- Keep beads schema migrated to the current bd version
- Watch dolt sql-server logs during doctor runs
When it happens
Trigger: RunDoltPerformanceDiagnostics -> runDoltServerDiagnostics returns non-nil: sql.Open failure, ping timeout, or a diagnostic SQL query error.
Common situations: Server accepting TCP but rejecting auth (bad DSN credentials); database name wrong; queries failing due to schema drift or permissions; 30s ping timeout on a loaded server.
Related errors
- running performance diagnostics: %w
- failed to count issues: %w
- no beads configuration found in %s
- failed to open server connection: %w
- failed to begin transaction: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/ee57f12b40b613fb.
Report an issue: GitHub.