{"record":{"id":"2ea8436e27c87b16","repo":"golang-migrate/migrate","slug":"unable-to-parse-option-x-migrations-table-quoted-2ea843","errorCode":null,"errorMessage":"unable to parse option x-migrations-table-quoted: %w","messagePattern":"unable to parse option x-migrations-table-quoted: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"database/pgx/v5/pgx.go","lineNumber":160,"sourceCode":"\t\treturn nil, err\n\t}\n\n\t// Driver is registered as pgx, but connection string must use postgres schema\n\t// when making actual connection\n\t// i.e. pgx://user:password@host:port/db => postgres://user:password@host:port/db\n\tpurl.Scheme = \"postgres\"\n\n\tdb, err := sql.Open(\"pgx/v5\", migrate.FilterCustomQuery(purl).String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmigrationsTable := purl.Query().Get(\"x-migrations-table\")\n\tmigrationsTableQuoted := false\n\tif s := purl.Query().Get(\"x-migrations-table-quoted\"); len(s) > 0 {\n\t\tmigrationsTableQuoted, err = strconv.ParseBool(s)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to parse option x-migrations-table-quoted: %w\", err)\n\t\t}\n\t}\n\tif (len(migrationsTable) > 0) && (migrationsTableQuoted) && ((migrationsTable[0] != '\"') || (migrationsTable[len(migrationsTable)-1] != '\"')) {\n\t\treturn nil, fmt.Errorf(\"x-migrations-table must be quoted (for instance '\\\"migrate\\\".\\\"schema_migrations\\\"') when x-migrations-table-quoted is enabled, current value is: %s\", migrationsTable)\n\t}\n\n\tstatementTimeoutString := purl.Query().Get(\"x-statement-timeout\")\n\tstatementTimeout := 0\n\tif statementTimeoutString != \"\" {\n\t\tstatementTimeout, err = strconv.Atoi(statementTimeoutString)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tmultiStatementMaxSize := DefaultMultiStatementMaxSize\n\tif s := purl.Query().Get(\"x-multi-statement-max-size\"); len(s) > 0 {\n\t\tmultiStatementMaxSize, err = strconv.Atoi(s)","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/database/pgx/v5/pgx.go#L142-L178","documentation":"When opening a pgx/v5 Postgres connection via URL, golang-migrate reads the x-migrations-table-quoted query option and parses it with strconv.ParseBool. If the value is not a valid boolean ('true', 'false', '1', '0', etc.), Open fails with this wrapped parse error. It is a URL-configuration validation error, not a database failure.","triggerScenarios":"Calling postgres.Withpgx5/Driver Open (or database/sql registration) with a connection URL containing x-migrations-table-quoted set to a non-boolean value, e.g. postgres://user:pass@host/db?x-migrations-table-quoted=yes or =TRUE (uppercase is invalid for ParseBool).","commonSituations":"Typo in the option value, copying 'True'/'yes'/'on' from documentation or another library, shell quoting stripping or mangling the value, or programmatically interpolating a non-boolean variable into the DSN.","solutions":["Set x-migrations-table-quoted to a value strconv.ParseBool accepts: 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False","Remove the x-migrations-table-quoted parameter entirely if you don't need a quoted migrations table name","Verify the value has no surrounding whitespace or shell-mangled characters in the URL","Check the underlying strconv error wrapped via %w to see exactly which value failed to parse"],"exampleFix":"// before\ndsn := \"postgres://user:pass@host/db?x-migrations-table-quoted=yes\"\n// after\ndsn := \"postgres://user:pass@host/db?x-migrations-table-quoted=true\"","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(dsn)\nif v := u.Query().Get(\"x-migrations-table-quoted\"); v != \"\" {\n    if _, err := strconv.ParseBool(v); err != nil {\n        return fmt.Errorf(\"invalid x-migrations-table-quoted %q: %w\", v, err)\n    }\n}","typeGuard":"func validBoolOption(v string) bool {\n    _, err := strconv.ParseBool(v)\n    return err == nil\n}","tryCatchPattern":"if err := m.Up(); err != nil {\n    var parseErr *strconv.NumError\n    if strings.Contains(err.Error(), \"unable to parse option x-migrations-table-quoted\") {\n        log.Fatalf(\"fix the DSN boolean option: %v\", err)\n    }\n    _ = parseErr\n}","preventionTips":["Use strconv.ParseBool-accepted literals (true/false/1/0) in DSN options","Validate DSN query options with url.ParseQuery at app startup","Keep boolean DSN options in one shared constant/config, not inline strings"],"tags":["configuration","url-parameters","postgres","parsing"],"backgroundTag":"invalid-url-option-value","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}