Skip to content

fix: clean config error messages for operators - #46

Merged
rahulcrl merged 1 commit into
mainfrom
improve_config_error_ux
Jul 21, 2026
Merged

rahulcrl merged 1 commit into
mainfrom
improve_config_error_ux

Conversation

@rahulcrl

@rahulcrl rahulcrl commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Config errors now print a single readable line to stderr with a README link instead of a JSON zap log with full stack traces
  • Runtime errors (connection failures, unexpected panics) still get the structured zap treatment
  • db.ErrInvalidConfig sentinel marks config-shaped errors (bad DSN, disallowed auth) detected after config.Load so main can route them to the plain-text path

Before

{"level":"error","ts":"...","caller":"main.go:58","msg":"fatal","error":"load config: set CRDB_DATABASE_URL or provide cert env vars; missing: [CRDB_HOST ...]","errorVerbose":"load config: ...\n(1) attached stack trace\n  -- stack trace:\n  | main.run\n  | .../main.go:67\n  ...20 more lines..."}

After

cockroachdb-mcp-server: invalid configuration: CRDB_DATABASE_URL must include sslmode (require, verify-ca, or verify-full)

See the Configuration section of the README:
https://github.com/cockroachdb/cockroachdb-mcp-server#configuration

Test plan

  • go test ./... passes (all 8 packages)
  • Manually verified all 6 config error paths produce clean output: missing config, bad DSN, missing sslmode, insecure sslmode without opt-in, password without opt-in, bad log path, invalid transport

@rahulcrl
rahulcrl force-pushed the improve_config_error_ux branch from 152ed3f to ed4228a Compare July 20, 2026 09:32
@rahulcrl
rahulcrl marked this pull request as ready for review July 20, 2026 11:42
@rahulcrl
rahulcrl force-pushed the improve_config_error_ux branch from ed4228a to 1ba248b Compare July 20, 2026 11:48
Comment thread main.go Resolved
@rahulcrl
rahulcrl force-pushed the improve_config_error_ux branch from 1ba248b to 331eebd Compare July 21, 2026 06:55
Comment thread db/adapter.go Resolved
@rahulcrl
rahulcrl force-pushed the improve_config_error_ux branch from 331eebd to 34627c7 Compare July 21, 2026 07:09
@rahulcrl

Copy link
Copy Markdown
Contributor Author

TFTR @TheComputerM!

Comment thread db/adapter.go Resolved
Config errors (missing env vars, bad DSN, disallowed auth) now print
a single readable line with a README link instead of a JSON log with
stack traces. Runtime errors still get the structured zap treatment.
@rahulcrl
rahulcrl force-pushed the improve_config_error_ux branch from 34627c7 to adfacf7 Compare July 21, 2026 07:21
Comment thread main.go Resolved
@rahulcrl
rahulcrl merged commit 39c27b3 into main Jul 21, 2026
4 checks passed
@rahulcrl
rahulcrl deleted the improve_config_error_ux branch July 21, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

⌂ 换网址