{"record":{"id":"afb73dff30cc45b1","repo":"googleapis/mcp-toolbox","slug":"invalid-iptype-s","errorCode":null,"errorMessage":"invalid ipType %s","messagePattern":"invalid ipType (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/alloydbpg/alloydb_pg.go","lineNumber":157,"sourceCode":"\t}\n\t// this will catch actual query execution errors\n\tif err := results.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to execute query: %w\", err)\n\t}\n\treturn out, nil\n}\n\nfunc getOpts(ipType, userAgent string, useIAM bool) ([]alloydbconn.Option, error) {\n\topts := []alloydbconn.Option{alloydbconn.WithUserAgent(userAgent)}\n\tswitch strings.ToLower(ipType) {\n\tcase \"private\":\n\t\topts = append(opts, alloydbconn.WithDefaultDialOptions(alloydbconn.WithPrivateIP()))\n\tcase \"public\":\n\t\topts = append(opts, alloydbconn.WithDefaultDialOptions(alloydbconn.WithPublicIP()))\n\tcase \"psc\":\n\t\topts = append(opts, alloydbconn.WithDefaultDialOptions(alloydbconn.WithPSC()))\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid ipType %s\", ipType)\n\t}\n\n\tif useIAM {\n\t\topts = append(opts, alloydbconn.WithIAMAuthN())\n\t}\n\treturn opts, nil\n}\n\nconst (\n\tpasswordDSNFormat = \"user=%s password=%s dbname=%s sslmode=disable application_name=%s\"\n\tiamDSNFormat      = \"user=%s dbname=%s sslmode=disable application_name=%s\"\n)\n\nfunc getConnectionConfig(ctx context.Context, user, pass, dbname string, readOnly bool) (string, bool, error) {\n\tuserAgent, err := util.UserAgentFromContext(ctx)\n\tif err != nil {\n\t\tuserAgent = \"genai-toolbox\"\n\t}","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/alloydbpg/alloydb_pg.go#L139-L175","documentation":"The getOpts helper maps the configured ipType string to an AlloyDB connector dial option, supporting only PUBLIC, PRIVATE, and PSC (case handled upstream). If the value is anything else, it returns 'invalid ipType %s'. This is a fail-fast config validation error thrown while building the connection pool.","triggerScenarios":"Configuring the alloydb-postgres source with an ipType other than public/private/psc (e.g. 'Public' with wrong casing handled incorrectly, 'internal', or an empty value that bypasses defaults).","commonSituations":"Copy-pasting configs between sources (Cloud SQL vs AlloyDB) with different accepted values, typos like 'privte', or programmatic config generation emitting unsupported values.","solutions":["Set ipType to one of: public, private, or psc.","Check the source config YAML for typos/casing and fix to the lowercase accepted values.","See the alloydb source docs reference for allowed ipType values.","If generating configs programmatically, validate against the enum before writing."],"exampleFix":"// before\nipType: internal\n// after\nipType: private","handlingStrategy":"validation","validationCode":"// Validate ipType against the allowed set before loading the source config\nfunc validIPType(v string) bool {\n    switch strings.ToLower(strings.TrimSpace(v)) {\n    case \"public\", \"private\", \"psc\":\n        return true\n    }\n    return false\n}\nif !validIPType(cfg.IPType) { return fmt.Errorf(\"ipType must be public, private, or psc; got %q\", cfg.IPType) }","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"invalid ipType\") {\n    return fmt.Errorf(\"fix ipType in source config to one of public|private|psc: %w\", err)\n}","preventionTips":["Only use documented values: public, private, psc","Lint source YAML configs against allowed enum values","Don't reuse Cloud SQL ipType values verbatim in AlloyDB configs","Lowercase ipType values in generated configs"],"tags":["go","configuration","alloydb","validation","ip-type"],"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"}