ipfs/kubo · error
no sources specified
Error message
no sources specified
What it means
GetMigrationFetcher builds a list of fetchers (HTTP and/or IPFS) from the configured DownloadSources. If the sources list is empty after processing, no fetcher can be constructed, so it returns this error instead of a nil-capable Fetcher. It is a guard against running migrations with no place to download migration binaries from.
Source
Thrown at repo/fsrepo/migrations/migrations.go:202
default:
u, err := url.Parse(src)
if err != nil {
return nil, fmt.Errorf("bad gateway address: %w", err)
}
switch u.Scheme {
case "":
u.Scheme = "https"
case "https", "http":
default:
return nil, errors.New("bad gateway address: url scheme must be http or https")
}
fetchers = append(fetchers, NewHttpFetcher(distPath, u.String(), httpUserAgent, 0))
}
}
switch len(fetchers) {
case 0:
return nil, errors.New("no sources specified")
case 1:
return fetchers[0], nil
}
// Wrap fetchers in a MultiFetcher to try them in order
return NewMultiFetcher(fetchers...), nil
}
func migrationName(from, to int) string {
return fmt.Sprintf("fs-repo-%d-to-%d", from, to)
}
// findMigrations returns a list of migrations, ordered from first to last
// migration to apply, and a map of locations of migration binaries of any
// migrations that were found.
//
// Deprecated: This function is used by legacy migration downloads and will be removed
// in a future version.View on GitHub (pinned to 329838acdf)
Solutions
- Set DownloadSources in the migrations config file (e.g. IPFS_PATH/migrations config) to a valid distribution URL
- Export IPFS_DIST_PATH to a mirror serving ipfs-update distributions
- Check ReadMigrationConfig output: the second return of GetMigrationFetcher's first argument comes from the config; ensure it is populated
- If running fully offline, obtain migration binaries another way (PATH lookup) instead of calling GetMigrationFetcher
Example fix
// before
fetcher, err := GetMigrationFetcher(nil, GetDistPathEnv(CurrentIpfsDist), nil) // sources nil
// after
sources := cfg.DownloadSources
if len(sources) == 0 {
sources = []string{"https://dist.ipfs.tech"}
}
fetcher, err := GetMigrationFetcher(sources, GetDistPathEnv(CurrentIpfsDist), nil) Defensive patterns
Strategy: validation
Validate before calling
sources := cfg.DownloadSources
if len(sources) == 0 {
sources = []string{"https://dist.ipfs.tech"}
}
fetcher, err := migration.GetMigrationFetcher(sources, migration.GetDistPathEnv(migration.CurrentIpfsDist), nil) Try / catch
if err != nil {
if err.Error() == "no sources specified" {
return fmt.Errorf("configure DownloadSources or set IPFS_DIST_PATH: %w", err)
}
return err
} Prevention
- Always pass a non-empty, non-nil DownloadSources slice
- Default to https://dist.ipfs.tech when config has no sources
- Validate config parsing before constructing fetchers
- Document required config for offline/mirror setups
When it happens
Trigger: Calling GetMigrationFetcher with an empty DownloadSources slice, or with sources that all fail to produce a fetcher (e.g. all entries invalid/unsupported schemes), so the fetchers slice ends up empty.
Common situations: Fresh ipfs repos or CI environments where the migrations config file is missing or has no DownloadSources set; users who cleared IPFS_DIST_PATH or the migration config's download sources; tests constructing a fetcher with nil/empty source lists.
Related errors
- failed to download migrations: %s
- failed to get migration fetcher: %w
- cannot get migrations from unknown fetcher type
- nothing downloaded by ipfs fetcher
- no local swarm address for migration node
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/c60ce64fa114952a.
Report an issue: GitHub.