googleapis/mcp-toolbox · error
invalid ipType %s
Error message
invalid ipType %s
What it means
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.
Source
Thrown at internal/sources/alloydbpg/alloydb_pg.go:157
}
// this will catch actual query execution errors
if err := results.Err(); err != nil {
return nil, fmt.Errorf("unable to execute query: %w", err)
}
return out, nil
}
func getOpts(ipType, userAgent string, useIAM bool) ([]alloydbconn.Option, error) {
opts := []alloydbconn.Option{alloydbconn.WithUserAgent(userAgent)}
switch strings.ToLower(ipType) {
case "private":
opts = append(opts, alloydbconn.WithDefaultDialOptions(alloydbconn.WithPrivateIP()))
case "public":
opts = append(opts, alloydbconn.WithDefaultDialOptions(alloydbconn.WithPublicIP()))
case "psc":
opts = append(opts, alloydbconn.WithDefaultDialOptions(alloydbconn.WithPSC()))
default:
return nil, fmt.Errorf("invalid ipType %s", ipType)
}
if useIAM {
opts = append(opts, alloydbconn.WithIAMAuthN())
}
return opts, nil
}
const (
passwordDSNFormat = "user=%s password=%s dbname=%s sslmode=disable application_name=%s"
iamDSNFormat = "user=%s dbname=%s sslmode=disable application_name=%s"
)
func getConnectionConfig(ctx context.Context, user, pass, dbname string, readOnly bool) (string, bool, error) {
userAgent, err := util.UserAgentFromContext(ctx)
if err != nil {
userAgent = "genai-toolbox"
}View on GitHub (pinned to 8cc6e09de2)
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.
Example fix
// before ipType: internal // after ipType: private
Defensive patterns
Strategy: validation
Validate before calling
// Validate ipType against the allowed set before loading the source config
func validIPType(v string) bool {
switch strings.ToLower(strings.TrimSpace(v)) {
case "public", "private", "psc":
return true
}
return false
}
if !validIPType(cfg.IPType) { return fmt.Errorf("ipType must be public, private, or psc; got %q", cfg.IPType) } Try / catch
src, err := cfg.Initialize(ctx, tracer)
if err != nil && strings.Contains(err.Error(), "invalid ipType") {
return fmt.Errorf("fix ipType in source config to one of public|private|psc: %w", err)
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: Copy-pasting configs between sources (Cloud SQL vs AlloyDB) with different accepted values, typos like 'privte', or programmatic config generation emitting unsupported values.
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
- password is provided without a username. Please provide both
- failed to initialize AlloyDB source in read-only mode: 'allo
- description is required for tool %q
- description is required for tool %q
- expected allowedDataset to have at least 2 parts (project.da
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/afb73dff30cc45b1.
Report an issue: GitHub.