{"record":{"id":"6e4386884ff3b7ea","repo":"googleapis/mcp-toolbox","slug":"unsupported-language-q-supported-languages-are","errorCode":null,"errorMessage":"unsupported language %q: supported languages are %v","messagePattern":"unsupported language %q: supported languages are (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/cloudsqlconnect/types.go","lineNumber":110,"sourceCode":"\n// IsValidLanguage checks if the given language is supported.\nfunc IsValidLanguage(lang string) bool {\n\tnormalizedLang := Language(strings.ToLower(lang))\n\tfor _, l := range AvailableLanguages {\n\t\tif l == normalizedLang {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\n// ValidateLanguage returns an error if the language is not supported.\nfunc ValidateLanguage(lang string) error {\n\tif lang == \"\" {\n\t\treturn nil // empty is valid (means no code snippet requested)\n\t}\n\tif !IsValidLanguage(lang) {\n\t\treturn fmt.Errorf(\"unsupported language %q: supported languages are %v\", lang, AvailableLanguages)\n\t}\n\treturn nil\n}\n\n// ValidationCheck represents a single validation check result.\ntype ValidationCheck struct {\n\tName    string `json:\"name\"`\n\tStatus  string `json:\"status\"` // \"pass\", \"fail\", \"warn\", \"info\"\n\tMessage string `json:\"message\"`\n}\n\n// ValidationResult represents the result of network validation.\ntype ValidationResult struct {\n\tValid           bool              `json:\"valid\"`\n\tChecks          []ValidationCheck `json:\"checks\"`\n\tIssues          []string          `json:\"issues,omitempty\"`\n\tRecommendations []string          `json:\"recommendations,omitempty\"`\n}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/cloudsqlconnect/types.go#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use one of the exact supported values: python, nodejs, java, go","Map common synonyms before calling: 'javascript'/'js' -> 'nodejs', 'py'/'python3' -> 'python'","Omit the language parameter entirely (empty string) if no code snippet is needed"],"exampleFix":"// before\nValidateLanguage(\"javascript\")\n// after\nValidateLanguage(\"nodejs\") // supported: python, nodejs, java, go","handlingStrategy":"validation","validationCode":"var validLangs = map[string]bool{\"python\": true, \"nodejs\": true, \"java\": true, \"go\": true}\nlang := strings.ToLower(strings.TrimSpace(requestedLang))\nif lang != \"\" && !validLangs[lang] {\n    return fmt.Errorf(\"language %q unsupported; use python, nodejs, java, or go\", requestedLang)\n}","typeGuard":"func isSupportedLanguage(lang string) bool {\n    return cloudsqlconnect.IsValidLanguage(lang)\n}","tryCatchPattern":"if err := cloudsqlconnect.ValidateLanguage(lang); err != nil {\n    return fmt.Errorf(\"%w (hint: 'javascript' should be 'nodejs')\", err)\n}","preventionTips":["Map synonyms (js/javascript -> nodejs, py/python3 -> python) before calling","Compare languages case-insensitively and trim whitespace","Expose the supported-language list in your tool schema/enum so LLMs send valid values"],"tags":["validation","code-generation","parameters"],"backgroundTag":"unsupported-parameter-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"}