{"record":{"id":"f16947f597334cfb","repo":"hasura/graphql-engine","slug":"cannot-update-from-a-non-semver-version-s","errorCode":null,"errorMessage":"cannot update from a non-semver version: %s","messagePattern":"cannot update from a non-semver version: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/update-cli.go","lineNumber":80,"sourceCode":"\tf.StringVar(&opts.version, \"version\", \"\", \"a specific version to install\")\n\n\treturn updateCmd\n}\n\ntype updateOptions struct {\n\tEC *cli.ExecutionContext\n\n\tversion string\n}\n\nfunc (o *updateOptions) run(showPrompt bool) (err error) {\n\tvar op errors.Op = \"commands.updateOptions.run\"\n\n\tcurrentVersion := o.EC.Version.CLISemver\n\tif currentVersion == nil {\n\t\treturn errors.E(\n\t\t\top,\n\t\t\tfmt.Errorf(\"cannot update from a non-semver version: %s\", o.EC.Version.GetCLIVersion()),\n\t\t)\n\t}\n\n\tvar versionToBeInstalled *semver.Version\n\tif o.version != \"\" {\n\t\t// parse the version\n\t\tversionToBeInstalled, err = semver.NewVersion(o.version)\n\t\tif err != nil {\n\t\t\treturn errors.E(op, fmt.Errorf(\"unable to parse version: %w\", err))\n\t\t}\n\t} else {\n\t\to.EC.Spin(\"Checking for update... \")\n\t\thasUpdate, latestVersion, hasPreReleaseUpdate, preReleaseVersion, err := update.HasUpdate(\n\t\t\tcurrentVersion,\n\t\t\to.EC.LastUpdateCheckFile,\n\t\t)\n\t\to.EC.Spinner.Stop()\n","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/update-cli.go#L62-L98","documentation":"The update command requires a valid semver CLI version to compare against available releases. o.EC.Version.CLISemver is nil (the version string couldn't be parsed as semver), so the update check is aborted. This typically happens with dev builds where the version is not a semantic version.","triggerScenarios":"Running `hasura update-cli` on a binary built with a non-semver version string (e.g. 'dev', 'dirty', a git SHA, or an empty version), which makes semver parsing of CLIVersion fail and leaves CLISemver nil.","commonSituations":"Building the CLI from source without version ldflags, installing via a fork, or a corrupted install where the embedded version string is malformed.","solutions":["If built from source, rebuild embedding a proper semver, e.g. `go build -ldflags \"-X github.com/hasura/graphql/cli/version.BuildVersion=v2.30.0\"`","Or install an official release binary (curl the install script / release asset) and re-run update-cli","Check `hasura version` output — if it isn't a clean vX.Y.Z, that's the cause"],"exampleFix":"# before\n$ go build ./cmd/hasura && ./hasura update-cli\n# after\n$ go build -ldflags \"-X github.com/hasura/graphql/cli/version.BuildVersion=v2.30.0\" ./cmd/hasura && ./hasura update-cli","handlingStrategy":"type-guard","validationCode":"// verify the CLI reports a parseable semver before updating\nout, _ := exec.Command(\"hasura\", \"version\").Output()\nv, err := semver.NewVersion(strings.TrimSpace(strings.Fields(string(out))[0]))\nif err != nil || v == nil {\n    log.Fatal(\"CLI version is not semver; install an official release before updating\")\n}","typeGuard":"func canSelfUpdate(versionStr string) bool {\n    v, err := semver.NewVersion(versionStr)\n    return err == nil && v != nil\n}","tryCatchPattern":null,"preventionTips":["Build CLI binaries with a proper semver BuildVersion ldflag","Use official installers for deployable toolchains"],"tags":["hasura","cli","update","semver","version"],"backgroundTag":"invalid-semver-version","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}