hasura/graphql-engine · error

apply update: %w

Error message

apply update: %w

What it means

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'.

Source

Thrown at cli/commands/update-cli.go:161

	if versionToBeInstalled == nil {
		o.EC.Logger.WithField("version", currentVersion).Info("hasura cli is up to date")

		return nil
	}

	ec.Logger.Debugln("versionToBeInstalled: ", versionToBeInstalled.String())

	o.EC.Spin(fmt.Sprintf("Updating cli to v%s... ", versionToBeInstalled.String()))
	err = update.ApplyUpdate(versionToBeInstalled)

	o.EC.Spinner.Stop()

	if err != nil {
		if os.IsPermission(err) {
			return errors.E(op, "permission denied, try again as admin or with sudo")
		}

		return errors.E(op, fmt.Errorf("apply update: %w", err))
	}

	o.EC.Logger.WithField("version", "v"+versionToBeInstalled.String()).
		Info("Updated to latest version")

	return nil
}

func getChangeLogLink(version *semver.Version) string {
	return "https://github.com/hasura/graphql-engine/releases/tag/" + version.Original()
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Close other running hasura processes/terminals, then retry `hasura update-cli`
  2. If permission-related, rerun with sudo/administrator as the special-case message suggests
  3. Reinstall cleanly from the official install script or release asset, which replaces the binary outright
  4. Check disk space and that /tmp and the install dir are on the same filesystem (or set TMPDIR)

Example fix

# before
$ hasura update-cli   # text file busy
# after
$ pkill -f hasura || true; hasura update-cli
Defensive patterns

Strategy: retry

Validate before calling

// ensure no other hasura processes hold the binary before self-update
if out, err := exec.Command("pgrep", "-f", "hasura").Output(); err == nil && len(strings.Fields(string(out))) > 1 {
    log.Fatal("stop other hasura processes before updating")
}

Try / catch

if err := updateCmd.Run(); err != nil {
    if strings.Contains(err.Error(), "permission denied") {
        // rerun elevated
    } else if strings.Contains(err.Error(), "apply update") {
        // retry once after ensuring binary isn't busy; else reinstall from release asset
    }
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/8730238a99a694c8. Report an issue: GitHub.