googleapis/mcp-toolbox · error

invalid ipType %s. Must be one of `public`, `private`, or `p

Error message

invalid ipType %s. Must be one of `public`, `private`, or `psc`

What it means

GetCloudSQLOpts' switch on the configured ipType fell through to default: the value is not `public`, `private`, or `psc` (case-insensitive), so no Cloud SQL dial options can be built.

Source

Thrown at internal/sources/util.go:74

			return strs
		}
	}
	return val
}

// GetCloudSQLDialOpts retrieve dial options with the right ip type and user agent for cloud sql
// databases.
func GetCloudSQLOpts(ipType, userAgent string, useIAM bool) ([]cloudsqlconn.Option, error) {
	opts := []cloudsqlconn.Option{cloudsqlconn.WithUserAgent(userAgent)}
	switch strings.ToLower(ipType) {
	case "private":
		opts = append(opts, cloudsqlconn.WithDefaultDialOptions(cloudsqlconn.WithPrivateIP()))
	case "public":
		opts = append(opts, cloudsqlconn.WithDefaultDialOptions(cloudsqlconn.WithPublicIP()))
	case "psc":
		opts = append(opts, cloudsqlconn.WithDefaultDialOptions(cloudsqlconn.WithPSC()))
	default:
		return nil, fmt.Errorf("invalid ipType %s. Must be one of `public`, `private`, or `psc`", ipType)
	}

	if useIAM {
		opts = append(opts, cloudsqlconn.WithIAMAuthN())
	}
	return opts, nil
}

// GetIAMPrincipalEmailFromADC finds the email associated with ADC
func GetIAMPrincipalEmailFromADC(ctx context.Context, dbType string) (string, error) {
	// Finds ADC and returns an HTTP client associated with it
	client, err := google.DefaultClient(ctx,
		"https://www.googleapis.com/auth/userinfo.email")
	if err != nil {
		return "", fmt.Errorf("failed to call userinfo endpoint: %w", err)
	}

	// Retrieve the email associated with the token

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Set ipType to one of public, private, or psc in the source config
  2. Check for typos or surrounding whitespace in the value
  3. Omit ipType if the default behavior suffices
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/sources/util.go:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/136087077eb5c5bf. Report an issue: GitHub.