{"record":{"id":"f41b61283214048f","repo":"golang-migrate/migrate","slug":"no-schema-f41b61","errorCode":null,"errorMessage":"no schema","messagePattern":"no schema","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/snowflake/snowflake.go","lineNumber":30,"sourceCode":"\t\"sync/atomic\"\n\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) {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/snowflake/snowflake.go#L12-L48","documentation":"ErrNoSchema (message \"no schema\") is declared in the Snowflake driver (snowflake.go:30) and returned when the schema component of the DSN is empty. In Open (snowflake.go:115-118) the second path segment must be a non-empty schema name; WithInstance/WithConnection also require Config.SchemaName. Snowflake namespaces objects as database.schema.table, so a schema is mandatory.","triggerScenarios":"URLs like snowflake://user:pass@account//database (empty schema segment); WithInstance with Config.SchemaName == \"\".","commonSituations":"Assuming a default schema (like PUBLIC) is applied automatically; Postgres-style two-level DSN habits (db + search_path) carried over to Snowflake; env-var substitution leaving the schema slot blank.","solutions":["Include the schema in the path: snowflake://user:pass@account/PUBLIC/MYDB (segment order is account host, then /schema/database)","Set SchemaName in the Config when using WithInstance/WithConnection","Use PUBLIC explicitly if that is your intended default — it is not assumed for you"],"exampleFix":"// before\nurl := \"snowflake://user:pass@acct//MYDB\"\n// after\nurl := \"snowflake://user:pass@acct/PUBLIC/MYDB\"","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(dsn)\nparts := strings.Split(u.Path, \"/\")\nif len(parts) < 3 || parts[1] == \"\" {\n    return fmt.Errorf(\"snowflake DSN missing schema: %q\", u.Path)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave the schema path segment blank; specify PUBLIC explicitly if that's intended","Set Config.SchemaName when using WithInstance","Document the snowflake://user:pass@account/schema/database DSN shape in your team's templates"],"tags":["go","golang-migrate","snowflake","config","dsn","schema"],"backgroundTag":"missing-schema-name","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}