googleapis/mcp-toolbox · error
dialect invalid: must be one of "googlesql", or "postgresql"
Error message
dialect invalid: must be one of "googlesql", or "postgresql"
What it means
Thrown by Dialect.UnmarshalYAML in internal/sources/dialect.go when a configured dialect string is not one of the two supported values "googlesql" or "postgresql" (comparison is case-insensitive). Dialects are used by sources like BigQuery/Cloud SQL to select the SQL flavor; an unknown value makes the config invalid and initialization fails.
Source
Thrown at internal/sources/dialect.go:43
func (i *Dialect) String() string {
if string(*i) != "" {
return strings.ToLower(string(*i))
}
return "googlesql"
}
func (i *Dialect) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {
var dialect string
if err := unmarshal(&dialect); err != nil {
return err
}
switch strings.ToLower(dialect) {
case "googlesql", "postgresql":
*i = Dialect(strings.ToLower(dialect))
return nil
default:
return fmt.Errorf(`dialect invalid: must be one of "googlesql", or "postgresql"`)
}
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Change the dialect value in the config to exactly "googlesql" or "postgresql" (any casing).
- Check the source's documentation for which dialects it supports before setting the field.
- Remove the dialect field entirely if the source doesn't require one, if optional.
Example fix
# before dialect: mysql # after dialect: postgresql
Defensive patterns
Strategy: validation
Validate before calling
d := dialect.Dialect("")
allowed := map[string]bool{"googlesql": true, "postgresql": true}
if v := strings.TrimSpace(cfgDialect); v != "" && !allowed[strings.ToLower(v)] {
return fmt.Errorf("dialect %q unsupported: use googlesql or postgresql", v)
} Type guard
func isSupportedDialect(s string) bool {
switch strings.ToLower(s) {
case "googlesql", "postgresql":
return true
}
return false
} Try / catch
if err := yaml.Unmarshal(cfgBytes, &cfg); err != nil {
if strings.Contains(err.Error(), "dialect invalid") {
return fmt.Errorf("fix the dialect field in your config: must be googlesql or postgresql: %w", err)
}
return err
} Prevention
- Only use the documented values "googlesql" or "postgresql" in dialect fields.
- Copy dialect settings from the relevant source's docs, not from other databases' configs.
- Lint/validate YAML configs in CI before deployment to catch enum typos.
When it happens
Trigger: A YAML/tool config sets a dialect field to any string other than googlesql/postgresql (e.g. "mysql", "standard", "bigquery", or a typo like "googlesq") and the config is unmarshaled.
Common situations: Copy-pasting a dialect name from another database's config, assuming other engines are supported, capitalization concerns (not an issue — it's lowercased), or leaving a placeholder value in the YAML.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- doc %d: unexpected non-string key in input: %v
- doc %d: invalid config format at key %q: %w
- doc %d: invalid config format at key %q: expected nested for
- %s missing 'kind' field or it is not a string
- missing 'kind' field or it is not a string: %v
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/af9eb8b3898ed88a.
Report an issue: GitHub.