{"record":{"id":"4d665347d83f0f10","repo":"JanDeDobbeleer/oh-my-posh","slug":"no-match-at-root-level","errorCode":null,"errorMessage":"no match at root level","messagePattern":"no match at root level","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/runtime/terminal.go","lineNumber":744,"sourceCode":"\t\tif err == nil {\n\t\t\treturn &FileInfo{\n\t\t\t\tParentFolder: pwd,\n\t\t\t\tPath:         filepath.Join(pwd, parent),\n\t\t\t\tIsDir:        info.IsDir(),\n\t\t\t}, nil\n\t\t}\n\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif dir := filepath.Dir(pwd); dir != pwd {\n\t\t\tpwd = dir\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Error(err)\n\t\treturn nil, errors.New(\"no match at root level\")\n\t}\n}\n\nfunc (term *Terminal) StackCount() int {\n\tdefer log.Trace(time.Now())\n\n\tif term.CmdFlags.StackCount < 0 {\n\t\treturn 0\n\t}\n\n\treturn term.CmdFlags.StackCount\n}\n\nfunc (term *Terminal) Logs() string {\n\treturn log.String()\n}\n\nfunc (term *Terminal) DirMatchesOneOf(dir string, regexes []string) (match bool) {","sourceCodeStart":726,"sourceCodeEnd":762,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/runtime/terminal.go#L726-L762","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: always render path segment\n{{ .Path }}\n// after: only inside a git repo\n{{ if .Segments.Git }}{{ .Path }}{{ end }}","handlingStrategy":"fallback","validationCode":"// check ancestors yourself before relying on the segment\nfound := false\ndir, _ := filepath.Abs(\".\")\nfor {\n    if _, err := os.Stat(filepath.Join(dir, \".git\")); err == nil { found = true; break }\n    parent := filepath.Dir(dir)\n    if parent == dir { break }\n    dir = parent\n}","typeGuard":null,"tryCatchPattern":"gitRoot, err := term.HasParentFilePath(\".git\")\nif err != nil {\n    // not inside a repo: hide git segment\n    return nil\n}","preventionTips":["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)."],"tags":["filesystem","path","search"],"backgroundTag":"parent-file-not-found","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}