{"record":{"id":"c2abf3db2d6bdc02","repo":"golang-migrate/migrate","slug":"no-schema-database-name","errorCode":null,"errorMessage":"no schema/database name","messagePattern":"no schema/database name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/snowflake/snowflake.go","lineNumber":31,"sourceCode":"\n\t\"github.com/golang-migrate/migrate/v4/database\"\n\t\"github.com/lib/pq\"\n\tsf \"github.com/snowflakedb/gosnowflake\"\n)\n\nfunc init() {\n\tdb := Snowflake{}\n\tdatabase.Register(\"snowflake\", &db)\n}\n\nvar DefaultMigrationsTable = \"schema_migrations\"\n\nvar (\n\tErrNilConfig          = fmt.Errorf(\"no config\")\n\tErrNoDatabaseName     = fmt.Errorf(\"no database name\")\n\tErrNoPassword         = fmt.Errorf(\"no password\")\n\tErrNoSchema           = fmt.Errorf(\"no schema\")\n\tErrNoSchemaOrDatabase = fmt.Errorf(\"no schema/database name\")\n)\n\ntype Config struct {\n\tMigrationsTable string\n\tDatabaseName    string\n}\n\ntype Snowflake struct {\n\tisLocked atomic.Bool\n\tconn     *sql.Conn\n\tdb       *sql.DB\n\n\t// Open and WithInstance need to guarantee that config is never nil\n\tconfig *Config\n}\n\nfunc WithInstance(instance *sql.DB, config *Config) (database.Driver, error) {\n\tif config == nil {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/snowflake/snowflake.go#L13-L49","documentation":"ErrNoSchemaOrDatabase (message \"no schema/database name\") is returned by Snowflake's Open (snowflake.go:105-108) when the URL path, split on \"/\", has fewer than 3 segments — i.e. both the schema and database parts of the DSN are missing. It fires before the more specific ErrNoSchema/ErrNoDatabaseName checks and means the DSN lacks Snowflake's required /schema/database path structure entirely.","triggerScenarios":"Opening snowflake://user:pass@account (no path) or snowflake://user:pass@account/db (only one path segment); nurl.Parse yielding a Path with insufficient components.","commonSituations":"Postgres/MySQL-style DSNs (single database in the path) pasted into a Snowflake URL; missing trailing path in templated URLs; users confusing the account identifier with the database name.","solutions":["Provide the full path with both levels: snowflake://user:pass@account/schema/database","If migrating from a single-segment DSN template, add the schema segment (commonly PUBLIC) and the database segment","Validate the URL with url.Parse in your own code and assert len(strings.Split(p, \"/\")) >= 3 before calling Open"],"exampleFix":"// before\nurl := \"snowflake://user:pass@acct\"\n// after\nurl := \"snowflake://user:pass@acct/PUBLIC/MYDB\"","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(dsn)\nif len(strings.Split(u.Path, \"/\")) < 3 {\n    return fmt.Errorf(\"snowflake DSN must include /schema/database in the path: %q\", u.Path)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the full three-part DSN form snowflake://user:pass@account/schema/database everywhere","Do not reuse single-database DSN templates from Postgres/MySQL for Snowflake","Add a startup config check that parses every DSN and asserts path depth before calling migrate.New"],"tags":["go","golang-migrate","snowflake","config","dsn","url-parsing"],"backgroundTag":"invalid-dsn-format","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}