{"record":{"id":"af9eb8b3898ed88a","repo":"googleapis/mcp-toolbox","slug":"dialect-invalid-must-be-one-of-googlesql-or-p","errorCode":null,"errorMessage":"dialect invalid: must be one of \"googlesql\", or \"postgresql\"","messagePattern":"dialect invalid: must be one of \"googlesql\", or \"postgresql\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dialect.go","lineNumber":43,"sourceCode":"\nfunc (i *Dialect) String() string {\n\tif string(*i) != \"\" {\n\t\treturn strings.ToLower(string(*i))\n\t}\n\treturn \"googlesql\"\n}\n\nfunc (i *Dialect) UnmarshalYAML(ctx context.Context, unmarshal func(interface{}) error) error {\n\tvar dialect string\n\tif err := unmarshal(&dialect); err != nil {\n\t\treturn err\n\t}\n\tswitch strings.ToLower(dialect) {\n\tcase \"googlesql\", \"postgresql\":\n\t\t*i = Dialect(strings.ToLower(dialect))\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(`dialect invalid: must be one of \"googlesql\", or \"postgresql\"`)\n\t}\n}\n","sourceCodeStart":25,"sourceCodeEnd":46,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dialect.go#L25-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\ndialect: mysql\n# after\ndialect: postgresql","handlingStrategy":"validation","validationCode":"d := dialect.Dialect(\"\")\nallowed := map[string]bool{\"googlesql\": true, \"postgresql\": true}\nif v := strings.TrimSpace(cfgDialect); v != \"\" && !allowed[strings.ToLower(v)] {\n    return fmt.Errorf(\"dialect %q unsupported: use googlesql or postgresql\", v)\n}","typeGuard":"func isSupportedDialect(s string) bool {\n    switch strings.ToLower(s) {\n    case \"googlesql\", \"postgresql\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := yaml.Unmarshal(cfgBytes, &cfg); err != nil {\n    if strings.Contains(err.Error(), \"dialect invalid\") {\n        return fmt.Errorf(\"fix the dialect field in your config: must be googlesql or postgresql: %w\", err)\n    }\n    return err\n}","preventionTips":["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."],"tags":["config","validation","yaml","dialect","bigquery"],"backgroundTag":"invalid-enum-value","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}