golang-migrate/migrate · error

no password

Error message

no password

What it means

ErrNoPassword (message "no password") is returned by Snowflake's Open (snowflake.go:100-103) when the parsed URL has no password component: purl.User.Password() reports not-set. The driver builds a go-snowflake DSN that authenticates with user+password, so a passwordless URL cannot proceed. Note that a URL with only a username (snowflake://user@...) triggers this; a bare ':' with empty password may also fail here.

Source

Thrown at database/snowflake/snowflake.go:29

	"strings"
	"sync/atomic"

	"github.com/golang-migrate/migrate/v4/database"
	"github.com/lib/pq"
	sf "github.com/snowflakedb/gosnowflake"
)

func init() {
	db := Snowflake{}
	database.Register("snowflake", &db)
}

var DefaultMigrationsTable = "schema_migrations"

var (
	ErrNilConfig          = fmt.Errorf("no config")
	ErrNoDatabaseName     = fmt.Errorf("no database name")
	ErrNoPassword         = fmt.Errorf("no password")
	ErrNoSchema           = fmt.Errorf("no schema")
	ErrNoSchemaOrDatabase = fmt.Errorf("no schema/database name")
)

type Config struct {
	MigrationsTable string
	DatabaseName    string
}

type Snowflake struct {
	isLocked atomic.Bool
	conn     *sql.Conn
	db       *sql.DB

	// Open and WithInstance need to guarantee that config is never nil
	config *Config
}

View on GitHub (pinned to 01a9643f14)

Solutions

  1. Include the password in the URL: snowflake://user:password@account/schema/database
  2. If the password contains special characters, percent-encode them in the URL
  3. Inject the password from a secret store instead of a hardcoded DSN, and verify the env var is actually set in the runtime
  4. If using key-pair/SSO auth, this driver variant requires password auth — supply a password or extend the driver with a custom Config DSN path

Example fix

// before
url := os.Getenv("SNOWFLAKE_URL") // snowflake://user@acct/PUBLIC/DB
// after
url := fmt.Sprintf("snowflake://%s:%s@acct/PUBLIC/DB", user, url.QueryEscape(password))
Defensive patterns

Strategy: validation

Validate before calling

u, _ := url.Parse(dsn)
pw, ok := u.User.Password()
if !ok || pw == "" {
    return fmt.Errorf("snowflake DSN requires user:password credentials")
}

Prevention

When it happens

Trigger: Opening snowflake://user@account/schema/db without :password; env-var interpolation dropping the password; secrets stripped by an operator tool that redacts credentials.

Common situations: CI/CD secret injection removing special characters; DSNs copied from docs placeholders like snowflake://user:password@...; key-pair authentication setups where the operator assumed password auth is not needed.

Related errors


AI-assisted analysis of golang-migrate/migrate@01a9643f14 (2026-09-02). Data as JSON: /api/errors/88a130d3a8007504. Report an issue: GitHub.