googleapis/mcp-toolbox · error
invalid protocol: %s, must be one of: http, https
Error message
invalid protocol: %s, must be one of: http, https
What it means
validateConfig rejects a ClickHouse source config whose protocol field is neither empty, 'http', nor 'https'. The protocol selects the DSN scheme used to build the clickhouse-go connection string, so only these two values are meaningful.
Source
Thrown at internal/sources/clickhouse/clickhouse.go:175
default:
vMap[name] = rawValues[i]
}
}
out = append(out, vMap)
}
if err := results.Err(); err != nil {
return nil, fmt.Errorf("errors encountered by results.Scan: %w", err)
}
return out, nil
}
func validateConfig(protocol string) error {
validProtocols := map[string]bool{"http": true, "https": true}
if protocol != "" && !validProtocols[protocol] {
return fmt.Errorf("invalid protocol: %s, must be one of: http, https", protocol)
}
return nil
}
func initClickHouseConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, protocol string, secure bool) (*sql.DB, error) {
//nolint:all // Reassigned ctx
ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)
defer span.End()
if protocol == "" {
protocol = "https"
}
if err := validateConfig(protocol); err != nil {
return nil, err
}
encodedUser := url.QueryEscape(user)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Change protocol in the source YAML to 'http' or 'https' (lowercase)
- Remove the protocol field entirely — an empty value is accepted and treated as non-secure default
- Check for stray whitespace or capitalization in the YAML value
Example fix
// before protocol: "tcp" // after protocol: "https"
Defensive patterns
Strategy: validation
Validate before calling
func validProtocol(p string) bool { return p == "" || p == "http" || p == "https" }
// call before writing config: if !validProtocol(cfg.Protocol) { return errors.New("protocol must be http or https") } Prevention
- Keep protocol values lowercase: 'http' or 'https'
- Omit the field entirely for the default behavior
- Validate YAML source configs before deploying
- Add a config-lint step in CI for source definitions
When it happens
Trigger: Setting protocol to any non-empty string other than 'http' or 'https' in the source YAML (e.g. 'tcp', 'HTTP', 'native') when declaring the clickhouse source; Initialize then calls validateConfig before opening the pool.
Common situations: Copy-pasting a native clickhouse-client port config (protocol 'tcp') from another tool, or using uppercase/lowercase typos like 'HTTPS' when wiring the YAML config.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- `introspectionEndpoint` is not allowed when `mcpEnabled` is
- `introspectionMethod` is not allowed when `mcpEnabled` is fa
- `introspectionParamName` is not allowed when `mcpEnabled` is
- error parsing argument: %w
- invalid role %q: must be 'user' or 'assistant'
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/ba9cd263ff28f509.
Report an issue: GitHub.