{"record":{"id":"f523b28b0cb43c8b","repo":"ipfs/kubo","slug":"could-not-find-a-non-dev-version","errorCode":null,"errorMessage":"could not find a non dev version","messagePattern":"could not find a non dev version","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"repo/fsrepo/migrations/versions.go","lineNumber":36,"sourceCode":"// LatestDistVersion returns the latest version, of the specified distribution,\n// that is available on the distribution site.\nfunc LatestDistVersion(ctx context.Context, fetcher Fetcher, dist string, stableOnly bool) (string, error) {\n\tvs, err := DistVersions(ctx, fetcher, dist, false)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor i := len(vs) - 1; i >= 0; i-- {\n\t\tver := vs[i]\n\t\tif stableOnly && strings.Contains(ver, \"-rc\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.Contains(ver, \"-dev\") {\n\t\t\tcontinue\n\t\t}\n\t\treturn ver, nil\n\t}\n\treturn \"\", errors.New(\"could not find a non dev version\")\n}\n\n// DistVersions returns all versions of the specified distribution, that are\n// available on the distriburion site.  List is in ascending order, unless\n// sortDesc is true.\nfunc DistVersions(ctx context.Context, fetcher Fetcher, dist string, sortDesc bool) ([]string, error) {\n\tversionBytes, err := fetcher.Fetch(ctx, path.Join(dist, distVersions))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprefix := \"v\"\n\tvar vers []semver.Version\n\n\tscan := bufio.NewScanner(bytes.NewReader(versionBytes))\n\tfor scan.Scan() {\n\t\tver, err := semver.Make(strings.TrimLeft(scan.Text(), prefix))\n\t\tif err != nil {","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/migrations/versions.go#L18-L54","documentation":"LatestDistVersion iterates the available versions of a distribution (from DistVersions) and returns the first one that is not a -dev pre-release; if the scan ends without finding any non-dev version it returns this error. It means every version published for that distribution is a dev build (or the list was empty/unparseable).","triggerScenarios":"Calling LatestDistVersion for a dist name where all listed versions contain \"-dev\" — e.g. a typo'd or experimental dist name, a dist whose only published tags are dev builds, or a fetcher returning an empty/degenerate version list so the loop body never yields a stable version.","commonSituations":"Pointing ipfs-update at a custom/unofficial dist endpoint that only publishes -dev builds, asking for the latest version of a brand-new dist before its first stable release, or an intercepted/corrupted response yielding only malformed versions.","solutions":["Verify the distribution name and fetch endpoint are correct (official dists publish stable releases).","Use DistVersions to list what is actually available and pin a known stable version explicitly instead of LatestDistVersion.","If you intentionally want a dev build, install that version directly rather than via latest-version lookup.","Inspect the dist site's responses to confirm the version list is being served correctly."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"vers, err := migrations.DistVersions(ctx, fetcher, dist, true)\nif err != nil { return err }\nhasStable := false\nfor _, v := range vers {\n\tif !strings.Contains(v, \"-dev\") { hasStable = true; break }\n}\nif !hasStable {\n\treturn fmt.Errorf(\"dist %s has no stable releases; available: %v\", dist, vers)\n}","typeGuard":null,"tryCatchPattern":"ver, err := migrations.LatestDistVersion(ctx, fetcher, dist)\nif err != nil {\n\tif err.Error() == \"could not find a non dev version\" {\n\t\t// fall back to a pinned known-good version\n\t\tver = fallbackVersion\n\t} else {\n\t\treturn err\n\t}\n}","preventionTips":["Pin explicit stable versions in scripts instead of resolving latest.","Validate dist names and endpoints before querying versions.","List DistVersions first and assert at least one non-dev version exists."],"tags":["versioning","network","migrations"],"backgroundTag":"no-stable-version-found","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"}