{"record":{"id":"ba9cd263ff28f509","repo":"googleapis/mcp-toolbox","slug":"invalid-protocol-s-must-be-one-of-http-https","errorCode":null,"errorMessage":"invalid protocol: %s, must be one of: http, https","messagePattern":"invalid protocol: (.+?), must be one of: http, https","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/clickhouse/clickhouse.go","lineNumber":175,"sourceCode":"\t\t\tdefault:\n\t\t\t\tvMap[name] = rawValues[i]\n\t\t\t}\n\t\t}\n\t\tout = append(out, vMap)\n\t}\n\n\tif err := results.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"errors encountered by results.Scan: %w\", err)\n\t}\n\n\treturn out, nil\n}\n\nfunc validateConfig(protocol string) error {\n\tvalidProtocols := map[string]bool{\"http\": true, \"https\": true}\n\n\tif protocol != \"\" && !validProtocols[protocol] {\n\t\treturn fmt.Errorf(\"invalid protocol: %s, must be one of: http, https\", protocol)\n\t}\n\treturn nil\n}\n\nfunc initClickHouseConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, protocol string, secure bool) (*sql.DB, error) {\n\t//nolint:all // Reassigned ctx\n\tctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)\n\tdefer span.End()\n\n\tif protocol == \"\" {\n\t\tprotocol = \"https\"\n\t}\n\n\tif err := validateConfig(protocol); err != nil {\n\t\treturn nil, err\n\t}\n\n\tencodedUser := url.QueryEscape(user)","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/clickhouse/clickhouse.go#L157-L193","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nprotocol: \"tcp\"\n// after\nprotocol: \"https\"","handlingStrategy":"validation","validationCode":"func validProtocol(p string) bool { return p == \"\" || p == \"http\" || p == \"https\" }\n// call before writing config: if !validProtocol(cfg.Protocol) { return errors.New(\"protocol must be http or https\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["clickhouse","configuration","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}