rg fails with some special pattern in .gitignore

Resolved 💬 3 comments Opened Oct 9, 2025 by Meowzz95 Closed Oct 16, 2025
💡 Likely answer: A maintainer (dylan-hurd-oai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.46.0

Which model were you using?

gpt-5-codex hight

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

Having this in .gitignore

# General
.DS_Store
__MACOSX/
.AppleDouble
.LSOverride
Icon[
]

I don't know if the Icon[ and ] are supposed to be on two lines but this triggers rg error when codex try to search something in the codebase

• Ran rg --line-number "someFunc" -n xxxxxx/src -g"*.ts" -g"*.vue"
  └ failed in sandbox: rg: /Users/xxxx/.gitignore: line 50: error
    parsing glob 'Icon[': unclosed character class; missing ']'

Although codex will figure out some other commend to search but I think this can be avoided (?)

What is the expected behavior?

Although codex will figure out some other commend to search but I think this can be avoided (?)

What do you see instead?

Shown in repro

Additional information

_No response_

View original on GitHub ↗

3 Comments

Meowzz95 · 10 months ago

It seems that the

Icon[
]

is expected.

It was added by the vscode gitignore extension (select macos in the dropdown)

dylan-hurd-oai contributor · 10 months ago

@Meowzz95 that appears to just be an invalid .gitignore pattern. For example, I can repro the same issue if I run rg directly with this in my gitignore, so it's not a codex-specific issue. Please report the issue to https://github.com/github/gitignore