Jguer/yay · error

%s - %w

Error message

%s - %w

What it means

Wraps failures from `earlyRefresh` (database refresh via -Sy) during `NewOperationService` setup, prefixing the localized message "error refreshing databases". Refreshing pacsync/repos databases failed before the install/sync operation could start.

Solutions

  1. Read the wrapped cause after the prefix to see the underlying refresh failure (network vs lock vs permission).
  2. Check network/mirror connectivity; switch to a working mirror if one is down.
  3. Ensure no other package-manager process is running (db lock) and you have the required privileges.
  4. Retry after transient network issues.
Defensive patterns

Strategy: retry

Validate before calling

if err := checkMirrorReachability(ctx, cfg); err != nil {
    // warn user before attempting a database refresh
}

Try / catch

if errR := earlyRefresh(ctx, cfg, cmdBuilder, cmdArgs); errR != nil {
    return fmt.Errorf("error refreshing databases: %w", errR)
}
// caller: inspect the wrapped cause to distinguish network vs lock vs permission

Prevention

When it happens

Trigger: User passed a refresh flag (e.g. -y/-u) with a mode at least repo-level; `earlyRefresh` runs the package-manager refresh command and it returns an error (network failure, mirror down, permission/lock on the db, bad mirrorlist).

Common situations: No internet connection or DNS failure, unreachable/broken mirrors, another package-manager process holding the database lock, running without sufficient privileges where required.

Related errors


AI-assisted analysis of Jguer/yay@328f4b4939 (2026-09-07). Data as JSON: /api/errors/6b6688b873070594. Report an issue: GitHub.

Appendix: source

Thrown at sync.go:36

	"github.com/Jguer/yay/v13/pkg/upgrade"
)

func syncInstall(ctx context.Context,
	run *runtime.Runtime,
	cmdArgs *parser.Arguments,
	dbExecutor db.Executor,
) error {
	aurCache := run.AURClient
	refreshArg := cmdArgs.ExistsArg("y", "refresh")
	noDeps := cmdArgs.ExistsArg("d", "nodeps")
	noCheck := strings.Contains(run.Cfg.MFlags, "--nocheck")
	if noDeps {
		run.CmdBuilder.AddMakepkgFlag("-d")
	}

	if refreshArg && run.Cfg.Mode.AtLeastRepo() {
		if errR := earlyRefresh(ctx, run.Cfg, run.CmdBuilder, cmdArgs); errR != nil {
			return fmt.Errorf("%s - %w", gotext.Get("error refreshing databases"), errR)
		}

		// we may have done -Sy, our handle now has an old
		// database.
		if errRefresh := dbExecutor.RefreshHandle(); errRefresh != nil {
			return errRefresh
		}
	}

	grapher := dep.NewGrapher(dbExecutor, aurCache, false, settings.NoConfirm,
		noDeps, noCheck, cmdArgs.ExistsArg("needed"), run.Logger.Child("grapher"))

	graph, err := grapher.GraphFromTargets(ctx, nil, cmdArgs.Targets)
	if err != nil {
		return err
	}

	excluded := []string{}

View on GitHub (pinned to 328f4b4939)