Skip to content

[bug] Ask cannot handle files with special characters #771

@marshallwp

Description

@marshallwp

Describe the bug

Say you have a file named: (pr that you want to find. You can search for this with Sourcebot via the query file:"\(pr".

If you Ask Sourcebot about it, it will try a number of things, all of which either result in query failure or returning incorrect results.

Query: find me file:"\(pr"

GPT-5-nano Response
  1. Searched for \(pr
    Failed with the following error: Failed to parse query "\(pr reposet:gitlab/example-repo" with message: No parse at 65

  2. Searched for \(pr ( repo:gitlab/example-repo )
    Failed with the following error: Failed to parse query "\(pr reposet:gitlab/example-repo ( repo:gitlab/example-repo )" with message: No parse at 127

  3. Searched for pr ( repo:gitlab/example-repo )
    Returned src/app/routes/endpoint.py

GPT-5-mini Response
  1. I'll search the repository for files containing the literal substring "(pr" using the code search tool to locate all matches. This helps find files that include that pattern (likely a regex or string with an escaped parenthesis). I'll search only the selected repository.
    Searched for \\(pr ( repo:gitlab/example-repo )
    Failed with the following error: Failed to parse query "\\(pr reposet:gitlab/example-repo ( repo:gitlab/example-repo )" with message: No parse at 128

  2. Searched for "\\(pr" ( repo:gitlab/example-repo )
    Failed with the following error: Unexpected error: An unexpected error occurred. Please try again later.

Anthropic Claude Haiku 4.5
  1. The user is asking me to find files with a pattern "(pr". This seems to be a search for code that contains this literal string pattern - likely a regex or string pattern in code.

    Let me use the searchCode function to find this pattern. The user wants to search for the literal string "(pr" which appears to be a regex or escape sequence pattern.

    Since this is a regex search, I should search for files that contain this pattern. The user's query is "(pr" which I should escape properly for a regex search.

    Let me search for this code pattern.
    "Search code" tool call failed

  2. Searched for \\"\(pr ( repo:example-repo )
    Failed with the following error: Failed to parse query "\\"\(pr reposet:gitlab/example-repo ( repo:example-repo )" with message: No parse at 90

  3. Let me try a simpler regex pattern:
    Searched for \(pr ( repo:example-repo )
    Failed with the following error: Failed to parse query "\(pr reposet:gitlab/example-repo ( repo:example-repo )" with message: No parse at 87

  4. Let me try searching for just "pr" pattern:
    Searched for pr ( repo:example-repo )
    src/app/routes/endpoint.py

To reproduce

Use Sourcebot's Ask tool about files with strange names, such as (pr.

Sourcebot deployment information

Sourcebot version: v4.10.13

Additional information

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions