{"record":{"id":"8730238a99a694c8","repo":"hasura/graphql-engine","slug":"apply-update-w","errorCode":null,"errorMessage":"apply update: %w","messagePattern":"apply update: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/commands/update-cli.go","lineNumber":161,"sourceCode":"\tif versionToBeInstalled == nil {\n\t\to.EC.Logger.WithField(\"version\", currentVersion).Info(\"hasura cli is up to date\")\n\n\t\treturn nil\n\t}\n\n\tec.Logger.Debugln(\"versionToBeInstalled: \", versionToBeInstalled.String())\n\n\to.EC.Spin(fmt.Sprintf(\"Updating cli to v%s... \", versionToBeInstalled.String()))\n\terr = update.ApplyUpdate(versionToBeInstalled)\n\n\to.EC.Spinner.Stop()\n\n\tif err != nil {\n\t\tif os.IsPermission(err) {\n\t\t\treturn errors.E(op, \"permission denied, try again as admin or with sudo\")\n\t\t}\n\n\t\treturn errors.E(op, fmt.Errorf(\"apply update: %w\", err))\n\t}\n\n\to.EC.Logger.WithField(\"version\", \"v\"+versionToBeInstalled.String()).\n\t\tInfo(\"Updated to latest version\")\n\n\treturn nil\n}\n\nfunc getChangeLogLink(version *semver.Version) string {\n\treturn \"https://github.com/hasura/graphql-engine/releases/tag/\" + version.Original()\n}\n","sourceCodeStart":143,"sourceCodeEnd":173,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/commands/update-cli.go#L143-L173","documentation":"Final wrapping of any error from applying the downloaded update (replacing the CLI binary). The permission case is special-cased to a friendlier message; everything else (download failure, checksum mismatch, rename failure across filesystems, binary in use) surfaces as 'apply update: %w'.","triggerScenarios":"`hasura update-cli` where the new binary can't be swapped in: text-file-busy (binary currently executing on some platforms), cross-device rename from temp dir to install dir, interrupted download, or disk issues — and none of them os.IsPermission.","commonSituations":"Updating while other hasura processes run, /tmp on a different mount than the install dir, antivirus/lockers on the binary, partial downloads due to flaky networks.","solutions":["Close other running hasura processes/terminals, then retry `hasura update-cli`","If permission-related, rerun with sudo/administrator as the special-case message suggests","Reinstall cleanly from the official install script or release asset, which replaces the binary outright","Check disk space and that /tmp and the install dir are on the same filesystem (or set TMPDIR)"],"exampleFix":"# before\n$ hasura update-cli   # text file busy\n# after\n$ pkill -f hasura || true; hasura update-cli","handlingStrategy":"retry","validationCode":"// ensure no other hasura processes hold the binary before self-update\nif out, err := exec.Command(\"pgrep\", \"-f\", \"hasura\").Output(); err == nil && len(strings.Fields(string(out))) > 1 {\n    log.Fatal(\"stop other hasura processes before updating\")\n}","typeGuard":null,"tryCatchPattern":"if err := updateCmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"permission denied\") {\n        // rerun elevated\n    } else if strings.Contains(err.Error(), \"apply update\") {\n        // retry once after ensuring binary isn't busy; else reinstall from release asset\n    }\n}","preventionTips":["Close hasura watches/sessions before update-cli","Prefer clean reinstall from the install script when self-update keeps failing"],"tags":["hasura","cli","update","self-update","binary"],"backgroundTag":"self-update-apply-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}