{"record":{"id":"cbd76444d417941a","repo":"gofr-dev/gofr","slug":"unsupported-db-dialect-supported-dialects-are-m","errorCode":null,"errorMessage":"unsupported db dialect; supported dialects are - mysql, postgres, supabase, sqlite, %s","messagePattern":"unsupported db dialect; supported dialects are - mysql, postgres, supabase, sqlite, (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gofr/datasource/sql/sql.go","lineNumber":38,"sourceCode":"\t\"gofr.dev/pkg/gofr/config\"\n\t\"gofr.dev/pkg/gofr/datasource\"\n)\n\nconst (\n\tsqlite            = \"sqlite\"\n\tcockroachDB       = \"cockroachdb\"\n\tdefaultDBPort     = 3306\n\trequireSSLMode    = \"require\"\n\ttlsSkipVerify     = \"tls=skip-verify\"\n\tsslModeDisable    = \"disable\"\n\tsslModeVerifyCA   = \"verify-ca\"\n\tsslModeVerifyFull = \"verify-full\"\n\ttlsCustom         = \"tls=custom\"\n\tlocalhost         = \"localhost\"\n)\n\nvar (\n\terrUnsupportedDialect = fmt.Errorf(\n\t\t\"unsupported db dialect; supported dialects are - mysql, postgres, supabase, sqlite, %s\", cockroachDB)\n\terrFailedCACerts = fmt.Errorf(\"failed to append CA certificate\")\n)\n\n// DBConfig has those members which are necessary variables while connecting to database.\ntype DBConfig struct {\n\tDialect     string\n\tHostName    string\n\tUser        string\n\tPassword    string\n\tPort        string\n\tDatabase    string\n\tSSLMode     string\n\tMaxIdleConn int\n\tMaxOpenConn int\n\tCharset     string\n}\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/gofr-dev/gofr/blob/187eb24962502e91f1fee856230670958b66e89c/pkg/gofr/datasource/sql/sql.go#L20-L56","documentation":"errUnsupportedDialect is returned when the Dialect field of DBConfig is not one of the SQL dialects gofr supports: mysql, postgres, supabase, sqlite, or cockroachdb. NewSQL validates the dialect before building a connection string and refuses to construct a driver for anything unrecognized. It is a configuration-time error, not a runtime query error.","triggerScenarios":"Calling gofr.NewSQL with a DBConfig whose Dialect is misspelled, empty, or an unsupported engine (e.g. \"mssql\", \"orcale\", \"MySQL\" with different casing) — the dialect switch in NewSQL/getDBConnectionString falls through to the default case.","commonSituations":"Typo in the DIALect env value, using uppercase or mixed-case dialect names, pointing an app at a database engine gofr doesn't wrap (SQL Server, Oracle), or copying config from another framework that uses different dialect identifiers.","solutions":["Set Dialect to one of: mysql, postgres, supabase, sqlite, cockroachdb (exact lowercase spelling).","Check the DB_DIALECT environment variable for typos or extra whitespace.","If using an unsupported engine, switch to a gofr-supported database or use a raw driver outside gofr's datasource layer."],"exampleFix":"// before\ncfg := sql.DBConfig{Dialect: \"MySQL\", HostName: \"localhost\"}\n// after\ncfg := sql.DBConfig{Dialect: \"mysql\", HostName: \"localhost\"}","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"mysql\": true, \"postgres\": true, \"supabase\": true, \"sqlite\": true, \"cockroachdb\": true}\nif !supported[strings.ToLower(cfg.Dialect)] {\n    return fmt.Errorf(\"dialect %q not supported\", cfg.Dialect)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep dialect strings in one constants file and reference them instead of raw literals.","Lowercase/trim DB_DIALECT env values before use.","Add a startup smoke test that connects with the configured dialect in CI."],"tags":["database","configuration","sql"],"backgroundTag":"unsupported-database-dialect","analyzedSha":"187eb24962502e91f1fee856230670958b66e89c","analyzedAt":"2026-09-01T20:34:54.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}