googleapis/mcp-toolbox · error

invalid CIDR or IP address %q: %w

Error message

invalid CIDR or IP address %q: %w

What it means

Error "invalid CIDR or IP address %q: %w" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/sources/http/http.go:310

	for _, entry := range list {
		entry = strings.TrimSpace(entry)
		if entry == "" {
			continue
		}
		// If it is a single IP address (does not contain a slash), we can append /32 or /128
		if !strings.Contains(entry, "/") {
			ip := net.ParseIP(entry)
			if ip != nil {
				if ip.To4() != nil {
					entry = entry + "/32"
				} else {
					entry = entry + "/128"
				}
			}
		}
		_, ipNet, err := net.ParseCIDR(entry)
		if err != nil {
			return nil, fmt.Errorf("invalid CIDR or IP address %q: %w", entry, err)
		}
		nets = append(nets, ipNet)
	}
	return nets, nil
}

func createHTTPClient(duration time.Duration, tr *http.Transport, guard *SSRFGuard, res dnsResolver) (*http.Client, error) {
	if res != nil {
		guard.Resolver = res
	}

	resolver := guard.Resolver
	if resolver == nil {
		resolver = net.DefaultResolver
	}

	dialer := &net.Dialer{
		Timeout:   30 * time.Second,

View on GitHub (pinned to 8cc6e09de2)

When it happens

Trigger: Thrown at internal/sources/http/http.go:310 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/179426f7ef5646d1. Report an issue: GitHub.