googleapis/mcp-toolbox · error

unsupported language %q: supported languages are %v

Error message

unsupported language %q: supported languages are %v

What it means

ValidateLanguage checks that a requested code-snippet language is one of the supported values: python, nodejs, java, go (case-insensitive). Empty string is allowed and means no snippet. Any other value produces this error listing the available languages.

Source

Thrown at internal/util/cloudsqlconnect/types.go:110

// IsValidLanguage checks if the given language is supported.
func IsValidLanguage(lang string) bool {
	normalizedLang := Language(strings.ToLower(lang))
	for _, l := range AvailableLanguages {
		if l == normalizedLang {
			return true
		}
	}
	return false
}

// ValidateLanguage returns an error if the language is not supported.
func ValidateLanguage(lang string) error {
	if lang == "" {
		return nil // empty is valid (means no code snippet requested)
	}
	if !IsValidLanguage(lang) {
		return fmt.Errorf("unsupported language %q: supported languages are %v", lang, AvailableLanguages)
	}
	return nil
}

// ValidationCheck represents a single validation check result.
type ValidationCheck struct {
	Name    string `json:"name"`
	Status  string `json:"status"` // "pass", "fail", "warn", "info"
	Message string `json:"message"`
}

// ValidationResult represents the result of network validation.
type ValidationResult struct {
	Valid           bool              `json:"valid"`
	Checks          []ValidationCheck `json:"checks"`
	Issues          []string          `json:"issues,omitempty"`
	Recommendations []string          `json:"recommendations,omitempty"`
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Use one of the exact supported values: python, nodejs, java, go
  2. Map common synonyms before calling: 'javascript'/'js' -> 'nodejs', 'py'/'python3' -> 'python'
  3. Omit the language parameter entirely (empty string) if no code snippet is needed

Example fix

// before
ValidateLanguage("javascript")
// after
ValidateLanguage("nodejs") // supported: python, nodejs, java, go
Defensive patterns

Strategy: validation

Validate before calling

var validLangs = map[string]bool{"python": true, "nodejs": true, "java": true, "go": true}
lang := strings.ToLower(strings.TrimSpace(requestedLang))
if lang != "" && !validLangs[lang] {
    return fmt.Errorf("language %q unsupported; use python, nodejs, java, or go", requestedLang)
}

Type guard

func isSupportedLanguage(lang string) bool {
    return cloudsqlconnect.IsValidLanguage(lang)
}

Try / catch

if err := cloudsqlconnect.ValidateLanguage(lang); err != nil {
    return fmt.Errorf("%w (hint: 'javascript' should be 'nodejs')", err)
}

Prevention

When it happens

Trigger: Calling ValidateLanguage (via a tool's Invoke, e.g. when the LLM passes a language parameter) with values like 'javascript', 'py', 'typescript', 'csharp', 'Python ' with whitespace, or any non-empty string outside the four supported ones.

Common situations: LLM or client passes 'javascript' instead of 'nodejs', or 'python3' instead of 'python'; user asks for a language the tool doesn't generate snippets for.

Related errors


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