{"record":{"id":"6b6688b873070594","repo":"Jguer/yay","slug":"s-w-6b6688","errorCode":null,"errorMessage":"%s - %w","messagePattern":"%s - %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sync.go","lineNumber":36,"sourceCode":"\t\"github.com/Jguer/yay/v13/pkg/upgrade\"\n)\n\nfunc syncInstall(ctx context.Context,\n\trun *runtime.Runtime,\n\tcmdArgs *parser.Arguments,\n\tdbExecutor db.Executor,\n) error {\n\taurCache := run.AURClient\n\trefreshArg := cmdArgs.ExistsArg(\"y\", \"refresh\")\n\tnoDeps := cmdArgs.ExistsArg(\"d\", \"nodeps\")\n\tnoCheck := strings.Contains(run.Cfg.MFlags, \"--nocheck\")\n\tif noDeps {\n\t\trun.CmdBuilder.AddMakepkgFlag(\"-d\")\n\t}\n\n\tif refreshArg && run.Cfg.Mode.AtLeastRepo() {\n\t\tif errR := earlyRefresh(ctx, run.Cfg, run.CmdBuilder, cmdArgs); errR != nil {\n\t\t\treturn fmt.Errorf(\"%s - %w\", gotext.Get(\"error refreshing databases\"), errR)\n\t\t}\n\n\t\t// we may have done -Sy, our handle now has an old\n\t\t// database.\n\t\tif errRefresh := dbExecutor.RefreshHandle(); errRefresh != nil {\n\t\t\treturn errRefresh\n\t\t}\n\t}\n\n\tgrapher := dep.NewGrapher(dbExecutor, aurCache, false, settings.NoConfirm,\n\t\tnoDeps, noCheck, cmdArgs.ExistsArg(\"needed\"), run.Logger.Child(\"grapher\"))\n\n\tgraph, err := grapher.GraphFromTargets(ctx, nil, cmdArgs.Targets)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texcluded := []string{}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/Jguer/yay/blob/328f4b4939fb35f38c2f7c7ce3b8638a839bafa5/sync.go#L18-L54","documentation":"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.","triggerScenarios":"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).","commonSituations":"No internet connection or DNS failure, unreachable/broken mirrors, another package-manager process holding the database lock, running without sufficient privileges where required.","solutions":["Read the wrapped cause after the prefix to see the underlying refresh failure (network vs lock vs permission).","Check network/mirror connectivity; switch to a working mirror if one is down.","Ensure no other package-manager process is running (db lock) and you have the required privileges.","Retry after transient network issues."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if err := checkMirrorReachability(ctx, cfg); err != nil {\n    // warn user before attempting a database refresh\n}","typeGuard":null,"tryCatchPattern":"if errR := earlyRefresh(ctx, cfg, cmdBuilder, cmdArgs); errR != nil {\n    return fmt.Errorf(\"error refreshing databases: %w\", errR)\n}\n// caller: inspect the wrapped cause to distinguish network vs lock vs permission","preventionTips":["Ensure stable network/mirrors before running installs with refresh flags","Don't run concurrent package-manager operations that take the db lock","Configure multiple fallback mirrors so a single outage doesn't block refresh"],"tags":["package-manager","database-refresh","network","sync"],"backgroundTag":"database-refresh-failed","analyzedSha":"328f4b4939fb35f38c2f7c7ce3b8638a839bafa5","analyzedAt":"2026-09-07T16:45:12.608Z","contentChangedAt":"2026-09-07T16:45:12.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}