JanDeDobbeleer/oh-my-posh · info
no match at root level
Error message
no match at root level
What it means
findParentFilePath walks up the directory tree from the current working directory looking for a file or directory matching a pattern (e.g. .git). If it reaches the filesystem root without a match — dir == pwd means it cannot go higher — it logs and returns this error. It signals that no ancestor directory contains the sought path.
Source
Thrown at src/runtime/terminal.go:744
if err == nil {
return &FileInfo{
ParentFolder: pwd,
Path: filepath.Join(pwd, parent),
IsDir: info.IsDir(),
}, nil
}
if !os.IsNotExist(err) {
return nil, err
}
if dir := filepath.Dir(pwd); dir != pwd {
pwd = dir
continue
}
log.Error(err)
return nil, errors.New("no match at root level")
}
}
func (term *Terminal) StackCount() int {
defer log.Trace(time.Now())
if term.CmdFlags.StackCount < 0 {
return 0
}
return term.CmdFlags.StackCount
}
func (term *Terminal) Logs() string {
return log.String()
}
func (term *Terminal) DirMatchesOneOf(dir string, regexes []string) (match bool) {View on GitHub (pinned to 0976794618)
Solutions
- Verify you are inside the expected project tree (e.g. a git checkout) before relying on the segment.
- Configure the segment to hide gracefully when the parent file is not found (most segments do this by design).
- Check the pattern argument for typos (e.g. `.git` vs `git`).
- Use an explicit `folders`/`style` match on the working directory instead if you only want the segment inside specific projects.
Example fix
// before: always render path segment
{{ .Path }}
// after: only inside a git repo
{{ if .Segments.Git }}{{ .Path }}{{ end }} Defensive patterns
Strategy: fallback
Validate before calling
// check ancestors yourself before relying on the segment
found := false
dir, _ := filepath.Abs(".")
for {
if _, err := os.Stat(filepath.Join(dir, ".git")); err == nil { found = true; break }
parent := filepath.Dir(dir)
if parent == dir { break }
dir = parent
} Try / catch
gitRoot, err := term.HasParentFilePath(".git")
if err != nil {
// not inside a repo: hide git segment
return nil
} Prevention
- Make segments that search parent paths hide themselves when no match is found.
- Run prompts from inside project directories when you want repo-aware segments.
- Double-check pattern spelling (.git vs git).
When it happens
Trigger: HasParentFilePath(pattern) called when neither the working directory nor any of its ancestors contains the given file/directory name, and the walk terminates at the root.
Common situations: Running in a directory outside any git repository while a segment (e.g. git/upstream template) checks for .git; deep template using HasParentFilePath for marker files like package.json or .hg that simply does not exist above the cwd.
Related errors
- unable to delete font file after registry key open error
- unable to delete font file after registry key set error
- we do not have permissions to update
- NO VERSION
- no python executable found
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/4d665347d83f0f10.
Report an issue: GitHub.