JanDeDobbeleer/oh-my-posh · info

no matching window title found

Error message

no matching window title found

What it means

queryWindowTitles enumerates all top-level windows via EnumWindows and matches window titles against a pattern. When no window title matches, the collected title is empty and this error is raised; the wrapped message includes any enumeration error (e.g. from getWindowFileName) for diagnostics.

Solutions

  1. Confirm the expected application window actually exists and its title contains the searched text (inspect with Get-Process | Select MainWindowTitle).
  2. Avoid tools/scripts that rewrite the terminal window title ($Host.UI.RawUI.WindowTitle or echo -ne '\e]0;...') if window-title detection matters.
  3. This is usually harmless: the caller treats unmatched titles as 'not that app' and falls back to default behavior - no action needed unless you rely on window detection.
Defensive patterns

Strategy: fallback

Try / catch

// enumerate and fall back to default behavior when nothing matches
title, err := term.QueryWindowTitles(pattern)
if err != nil {
    // no matching window: proceed with non-window-specific behavior
}

Prevention

When it happens

Trigger: Calling QueryWindowTitles(pattern) when no currently visible top-level window's title contains the requested text, or when every candidate window failed processing (e.g. process open failures) leaving title empty.

Common situations: oh-my-posh checking whether it runs inside a known terminal window and the terminal's window title was customized by the user or a shell integration; running in a session without a visible window (ssh, service); the terminal's title changed due to a newer shell version.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/a180fc4b537eeb99. Report an issue: GitHub.

Appendix: source

Thrown at src/runtime/win32_windows.go:110

		title = syscall.UTF16ToString(b)
		if regex.MatchString(windowTitleRegex, title) {
			// will cause EnumWindows to return 0 (error)
			// but we don't want to enumerate all windows since we got what we want
			return 0
		}
		return 1 // continue enumeration
	})
	// Enumerates all top-level windows on the screen
	// The error is not checked because if EnumWindows is stopped before enumerating all windows
	// it returns 0(error occurred) instead of 1(success)
	// In our case, title will equal "" or the title of the window anyway
	err := enumWindows(cb, 0)
	if title == "" {
		var message string
		if err != nil {
			message = err.Error()
		}
		return "", errors.New("no matching window title found\n" + message)
	}
	return title, nil
}

var (
	advapi     = syscall.NewLazyDLL("advapi32.dll")
	procGetAce = advapi.NewProc("GetAce")
)

const (
	ACCESS_DENIED_ACE_TYPE = 1
)

type accessMask uint32

func (m accessMask) canWrite() bool {
	allowed := []int{windows.GENERIC_WRITE, windows.WRITE_DAC, windows.WRITE_OWNER}
	for _, v := range allowed {

View on GitHub (pinned to 0976794618)