Skip to main content

Synopsis

Check configuration files for errors, warnings, and potential issues. Validates syntax, types, and values.

Usage

watercooler config validate [options]

Options

--project-path
string
Project directory for config discovery. Defaults to current directory.
--strict
boolean
Treat warnings as errors (exit code 1 on any warning)

Examples

Validate current configuration

watercooler config validate
Output (success):
  ✓ Found: /home/user/.watercooler/config.toml
  ✓ Found: /path/to/project/.watercooler/config.toml

✓ Configuration is valid.
Exit code: 0

Validate with warnings

watercooler config validate
Output:
  ✓ Found: /home/user/.watercooler/config.toml

✓ Configuration is valid.

Warnings:
  ⚠ Port 80 requires root privileges.
  ⚠ fail_on_violation=true: Invalid entries will cause errors.
Exit code: 0 (warnings don’t fail by default)

Strict validation

watercooler config validate --strict
Output:
  ✓ Found: /home/user/.watercooler/config.toml

✓ Configuration is valid.

Warnings:
  ⚠ Port 80 requires root privileges.

--strict: Treating warnings as errors.
Exit code: 1 (strict mode fails on warnings)

Validation errors

watercooler config validate
Output:
  ✓ Found: /home/user/.watercooler/config.toml

Errors:
  ❌ Invalid port number: "abc" is not a valid integer
  ❌ Unknown transport type: "websocket" (must be "stdio" or "http")
Exit code: 1

Validate specific project

watercooler config validate --project-path ~/projects/myapp

No config files

watercooler config validate
Output:
Warnings:
  ⚠ No config files found. Using defaults.

✓ Configuration is valid.

Validation Checks

Syntax Validation

  • Valid TOML syntax
  • Proper section structure
  • Quoted strings where required
  • Valid data types

Type Validation

  • Port numbers are integers
  • Booleans are true/false
  • Paths are strings
  • Enums match allowed values

Value Validation

  • Port numbers in valid range (1-65535)
  • Transport is stdio or http
  • Paths are accessible
  • Required fields present

Semantic Validation

  • Threads directory exists or can be created
  • MCP port not in use (warning)
  • Conflicting settings (warning)

Common Errors

Invalid TOML syntax

Error:
❌ TOML syntax error: Expected '=' after key at line 5
Solution: Fix the syntax error in the config file.

Invalid port

Error:
❌ Invalid port number: 99999 (must be 1-65535)
Solution: Use a valid port number:
[mcp]
port = 3000

Invalid transport

Error:
❌ Unknown transport: "socket" (must be "stdio" or "http")
Solution:
[mcp]
transport = "stdio"  # or "http"

Type mismatch

Error:
❌ Type error: fail_on_violation must be boolean, got string
Solution:
[validation]
fail_on_violation = true  # not "true"

Common Warnings

Low port number

Warning:
⚠ Port 80 requires root privileges.
Impact: Non-root users cannot bind to ports < 1024. Solution: Use port >= 1024 (e.g., 3000, 8080).

Strict validation enabled

Warning:
⚠ fail_on_violation=true: Invalid entries will cause errors.
Impact: Invalid thread entries will fail operations. Solution: Disable for development:
[validation]
fail_on_violation = false

No config files

Warning:
⚠ No config files found. Using defaults.
Impact: Using built-in defaults. Solution: Create config if customization needed:
watercooler config init --user

Exit Codes

CodeMeaning
0Valid configuration
1Validation errors OR strict mode with warnings

Workflows

Pre-deployment check

#!/bin/bash
set -e
watercooler config validate --strict
echo "Configuration valid, deploying..."

CI/CD integration

# .github/workflows/validate.yml
steps:
  - name: Validate Watercooler config
    run: watercooler config validate --strict --project-path .

Development validation

# Check config after editing
watercooler config validate
if [ $? -eq 0 ]; then
  echo "✓ Config valid"
else
  echo "✗ Config has errors"
fi

Interactive fixing

# Validate and show config if errors
if ! watercooler config validate; then
  echo "Showing current config:"
  watercooler config show
fi

Build docs developers (and LLMs) love