{"record":{"id":"a4982c3ef584f5b8","repo":"ipfs/kubo","slug":"bad-gateway-address-url-scheme-must-be-http-or-ht","errorCode":null,"errorMessage":"bad gateway address: url scheme must be http or https","messagePattern":"bad gateway address: url scheme must be http or https","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"repo/fsrepo/migrations/migrations.go","lineNumber":194,"sourceCode":"\t\t\t// single-gateway outage.\n\t\t\tfor _, gw := range defaultMigrationGateways {\n\t\t\t\tfetchers = append(fetchers, NewHttpFetcher(distPath, gw, httpUserAgent, 0))\n\t\t\t}\n\t\tcase \"IPFS\", \"ipfs\":\n\t\t\treturn nil, errors.New(\"IPFS downloads are not supported for legacy migrations (repo versions <16). Please use only HTTPS in Migration.DownloadSources\")\n\t\tcase \"\":\n\t\t\t// Ignore empty string\n\t\tdefault:\n\t\t\tu, err := url.Parse(src)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"bad gateway address: %w\", err)\n\t\t\t}\n\t\t\tswitch u.Scheme {\n\t\t\tcase \"\":\n\t\t\t\tu.Scheme = \"https\"\n\t\t\tcase \"https\", \"http\":\n\t\t\tdefault:\n\t\t\t\treturn nil, errors.New(\"bad gateway address: url scheme must be http or https\")\n\t\t\t}\n\t\t\tfetchers = append(fetchers, NewHttpFetcher(distPath, u.String(), httpUserAgent, 0))\n\t\t}\n\t}\n\n\tswitch len(fetchers) {\n\tcase 0:\n\t\treturn nil, errors.New(\"no sources specified\")\n\tcase 1:\n\t\treturn fetchers[0], nil\n\t}\n\n\t// Wrap fetchers in a MultiFetcher to try them in order\n\treturn NewMultiFetcher(fetchers...), nil\n}\n\nfunc migrationName(from, to int) string {\n\treturn fmt.Sprintf(\"fs-repo-%d-to-%d\", from, to)","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/migrations/migrations.go#L176-L212","documentation":"Custom DownloadSources gateway URLs must use the http or https scheme (a missing scheme defaults to https). This error is returned when a parsed entry has some other scheme such as ftp, file, or ipfs.","triggerScenarios":"Migration.DownloadSources containing an entry like \"ftp://mirror.example.com\" or \"file:///path\"; also triggered when the entry parses but has a non-HTTP scheme.","commonSituations":"Pointing migrations at an internal mirror over an unsupported protocol; copying a distribution URL from a non-HTTP source; typos producing an unexpected scheme.","solutions":["Change the source to an https:// (or http://) URL.","Omit the scheme entirely if https is acceptable — a bare host defaults to https.","Remove invalid entries and rely on the default migration gateways."],"exampleFix":"// before\n\"DownloadSources\": [\"ftp://mirror.example.com/dist\"]\n// after\n\"DownloadSources\": [\"https://mirror.example.com/dist\"]","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(src)\nif u.Scheme != \"\" && u.Scheme != \"http\" && u.Scheme != \"https\" {\n    return fmt.Errorf(\"source %q must use http/https\", src)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"scheme must be http or https\") {\n        // rewrite the entry with an https:// prefix\n    }\n}","preventionTips":["Use only https:// URLs for custom download sources","Omit the scheme to accept the https default","Never point migrations at ftp/file/ipfs URLs"],"tags":["migrations","config-validation","url-scheme","go"],"backgroundTag":"bad-gateway-address","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}