golang-migrate/migrate · error
invalid value for x-connect-insecure: %w
Error message
invalid value for x-connect-insecure: %w
What it means
"invalid value for x-connect-insecure: %w" is raised in rqlite's parseConfigFromQuery (rqlite.go:322) when the x-connect-insecure query parameter cannot be parsed by strconv.ParseBool, wrapping ErrBadConfig. The parameter controls whether the connection is downgraded to plain http and therefore must be a Go-parseable boolean. Accepted values are 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False — not "yes", "no", or "on".
Source
Thrown at database/rqlite/rqlite.go:322
func parseConfigFromQuery(queryVals nurl.Values) (*Config, error) {
c := Config{
ConnectInsecure: DefaultConnectInsecure,
MigrationsTable: DefaultMigrationsTable,
}
migrationsTable := queryVals.Get("x-migrations-table")
if migrationsTable != "" {
if strings.HasPrefix(migrationsTable, "sqlite_") {
return nil, fmt.Errorf("invalid value for x-migrations-table: %w", ErrBadConfig)
}
c.MigrationsTable = migrationsTable
}
connectInsecureStr := queryVals.Get("x-connect-insecure")
if connectInsecureStr != "" {
connectInsecure, err := strconv.ParseBool(connectInsecureStr)
if err != nil {
return nil, fmt.Errorf("invalid value for x-connect-insecure: %w", ErrBadConfig)
}
c.ConnectInsecure = connectInsecure
}
return &c, nil
}
View on GitHub (pinned to 01a9643f14)
Solutions
- Use a ParseBool-compatible value: x-connect-insecure=true or x-connect-insecure=false
- Use 1/0 if you prefer a short form
- Check the env vars interpolated into the DSN for stray whitespace or quotes before the URL is built
Example fix
// before url := "rqlite://localhost:4001/db?x-connect-insecure=yes" // after url := "rqlite://localhost:4001/db?x-connect-insecure=true"
Defensive patterns
Strategy: validation
Validate before calling
v := q.Get("x-connect-insecure")
if v != "" {
if _, err := strconv.ParseBool(v); err != nil {
return fmt.Errorf("x-connect-insecure %q is not a valid bool", v)
}
} Prevention
- Only use 1/0/true/false (and Go's t/T/TRUE variants) for boolean query params
- Never use yes/no/on/off in DSN query strings
- Check for whitespace/quotes in env vars interpolated into URLs
When it happens
Trigger: URLs like ...?x-connect-insecure=yes, x-connect-insecure=on, x-connect-insecure=enabled, or with stray whitespace/quotes.
Common situations: Using SQL-style or CLI-style boolean conventions (yes/no/on/off) in the DSN; shell quoting or env-var interpolation injecting whitespace or empty quotes into the URL.
Related errors
- invalid value for x-migrations-table: %w
- both x-advisory-lock-timeout-interval and x-advisory-lock-ti
- no config
- bad parameter
- bad scheme: %w
AI-assisted analysis of golang-migrate/migrate@01a9643f14 (2026-09-02).
Data as JSON: /api/errors/a993711120232eec.
Report an issue: GitHub.