{"record":{"id":"fe1ca348f82c2ab9","repo":"ipfs/kubo","slug":"could-not-parse-our-own-version-q-w","errorCode":null,"errorMessage":"could not parse our own version %q: %w","messagePattern":"could not parse our own version %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/version.go","lineNumber":203,"sourceCode":"\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := cmds.EmitOnce(res, output); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t},\n}\n\n// DetectNewKuboVersion observers kubo version reported by other peers via\n// libp2p identify protocol and notifies when threshold fraction of seen swarm\n// is running updated Kubo. It is used by RPC and CLI at 'ipfs version check'\n// and also periodically when 'ipfs daemon' is running.\nfunc DetectNewKuboVersion(nd *core.IpfsNode, minPercent int64) (VersionCheckOutput, error) {\n\tourVersion, err := versioncmp.NewVersion(version.CurrentVersionNumber)\n\tif err != nil {\n\t\treturn VersionCheckOutput{}, fmt.Errorf(\"could not parse our own version %q: %w\",\n\t\t\tversion.CurrentVersionNumber, err)\n\t}\n\t// MAJOR.MINOR.PATCH without any suffix\n\tourVersion = ourVersion.Core()\n\n\tgreatestVersionSeen := ourVersion\n\ttotalPeersSampled := 1 // Us (and to avoid division-by-zero edge case)\n\twithGreaterVersion := 0\n\n\trecordPeerVersion := func(agentVersion string) {\n\t\t// We process the version as is it assembled in GetUserAgentVersion\n\t\tsegments := strings.Split(agentVersion, \"/\")\n\t\tif len(segments) < 2 {\n\t\t\treturn\n\t\t}\n\t\tif segments[0] != \"kubo\" {\n\t\t\treturn\n\t\t}","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/version.go#L185-L221","documentation":"DetectNewKuboVersion parses version.CurrentVersionNumber (the numeric Kubo version like '0.30.0') into a semver to compare against versions seen in the swarm. If that string cannot be parsed as a version, the error wraps the parse failure with the offending value. This indicates the compiled-in version string is malformed — a build/packaging problem, not a runtime issue.","triggerScenarios":"Calling 'ipfs version check' or running 'ipfs daemon' with periodic swarm version check when version.CurrentVersionNumber (set via ldflags at build time) is empty or not in a parseable MAJOR.MINOR.PATCH form.","commonSituations":"Building from a git checkout without the Makefile's ldflags injection (CurrentCommit/version left blank); custom build scripts that drop the -ldflags '-X github.com/ipfs/kubo/version.CurrentVersionNumber=...' flags; typos in a custom version string.","solutions":["Rebuild using make build so the Makefile injects the correct version ldflags","Ensure your build passes -ldflags \"-X github.com/ipfs/kubo/version.CurrentVersionNumber=<semver>\"","Check that the resulting 'ipfs version' prints a sane MAJOR.MINOR.PATCH number","Use an official release binary instead of a hand-built one"],"exampleFix":"// before (custom build script)\ngo build -o ipfs ./cmd/ipfs\n// after\nmake build  # or: go build -ldflags \"-X github.com/ipfs/kubo/version.CurrentVersionNumber=0.30.0\" -o ipfs ./cmd/ipfs","handlingStrategy":"validation","validationCode":"v := version.CurrentVersionNumber\nif v == \"\" {\n    return errors.New(\"version.CurrentVersionNumber is empty; build via make build\")\n}\nif _, err := versioncmp.NewVersion(v); err != nil {\n    return fmt.Errorf(\"bad embedded version %q: %w\", v, err)\n}","typeGuard":null,"tryCatchPattern":"out, err := DetectNewKuboVersion(nd, 25)\nif err != nil && strings.Contains(err.Error(), \"could not parse our own version\") {\n    // degrade: skip swarm version check, log a warning\n    log.Warnf(\"swarm version check skipped: %v\", err)\n    return VersionCheckOutput{}, nil\n}\nreturn out, err","preventionTips":["Always build kubo through make build so ldflags set CurrentVersionNumber","Sanity-check 'ipfs version' output after custom builds","Keep custom build scripts in sync with upstream ldflags requirements"],"tags":["versioning","build","ldflags"],"backgroundTag":"invalid-version-string","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"}