Jguer/yay · error

unable to CreateHandle

Error message

unable to CreateHandle: %s

What it means

Returned by AlpmExecutor.RefreshHandle when alpm.Initialize fails to create a libalpm handle for the configured RootDir and DBPath (after any previous handle was successfully released). The underlying libalpm error string is embedded. Common causes are an invalid or missing pacman database directory, wrong RootDir, or permission problems on the local pacman database.

Solutions

  1. Verify DBPath and RootDir in pacman.conf point to an existing pacman database
  2. Ensure the local database directory exists and is readable (usually /var/lib/pacman)
  3. Run with sufficient privileges if the database is root-owned
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at pkg/db/ialpm/alpm.go:253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at pkg/db/ialpm/alpm.go:253

			}

			qp.SetUseIndex(num - 1)

			break
		}
	}
}

func (ae *AlpmExecutor) RefreshHandle() error {
	if ae.handle != nil {
		if errRelease := ae.handle.Release(); errRelease != nil {
			return errRelease
		}
	}

	alpmHandle, err := alpm.Initialize(ae.conf.RootDir, ae.conf.DBPath)
	if err != nil {
		return errors.New(gotext.Get("unable to CreateHandle: %s", err))
	}

	if errConf := configureAlpm(ae.conf, alpmHandle); errConf != nil {
		return errConf
	}

	if err := alpmSetQuestionCallback(alpmHandle, ae.questionCallback()); err != nil {
		return err
	}
	if err := alpmSetLogCallback(alpmHandle, ae.logCallback()); err != nil {
		return err
	}
	ae.handle = alpmHandle
	ae.syncDBsCache = nil

	ae.syncDB, err = alpmHandle.SyncDBs()
	if err != nil {
		return err

View on GitHub (pinned to 328f4b4939)