charmbracelet/crush · error
symbol '%s' not found in grep results
Error message
symbol '%s' not found in grep results
What it means
After grep completes without error, resolveSymbolResults requires at least one textual match to locate the symbol. If the word-boundary pattern \\b<symbol>\\b matches nothing, it reports the symbol was not found in grep results, since no file can be handed to the LSP client.
Source
Thrown at internal/agent/tools/lsp_helpers.go:64
}
// resolveSymbolResults greps for a symbol and returns all viable
// {client, path, position} tuples. Callers that need just one match
// (definition, rename, call hierarchy) use resolveSymbol; callers that
// want to iterate all matches (references) use this directly.
func resolveSymbolResults(ctx context.Context, lspManager *lsp.Manager, symbol, workingDir string) ([]*resolvedSymbol, error) {
lspManager.Start(ctx, workingDir)
// Use word boundaries to avoid matching inside larger identifiers
// (e.g. "Bar" inside "myBar"). The symbol is already QuoteMeta'd
// so dots and other regex metacharacters are escaped.
pattern := `\b` + regexp.QuoteMeta(symbol) + `\b`
matches, _, err := searchFiles(ctx, pattern, workingDir, "", 100)
if err != nil {
return nil, fmt.Errorf("failed to search for symbol: %w", err)
}
if len(matches) == 0 {
return nil, fmt.Errorf("symbol '%s' not found in grep results", symbol)
}
var results []*resolvedSymbol
for _, match := range matches {
absPath, err := filepath.Abs(match.path)
if err != nil {
continue
}
client := findLSPClient(lspManager, absPath)
if client == nil {
continue
}
results = append(results, &resolvedSymbol{
client: client,
path: absPath,
line: match.lineNum,View on GitHub (pinned to 7944b8e522)
Solutions
- Verify spelling and case of the symbol.
- Check the symbol isn't excluded by .gitignore/.crushignore or the include filter; widen the search if so.
- Search manually with the grep tool to confirm the symbol's presence.
- If the symbol lives in dependencies, open the dependency file directly rather than relying on grep-based resolution.
Example fix
// before resolveSymbol(ctx, "UsrServc", dir) // typo // after resolveSymbol(ctx, "UserService", dir)
Defensive patterns
Strategy: fallback
Validate before calling
hits, _, err := searchFiles(ctx, "\\b"+regexp.QuoteMeta(sym)+"\\b", dir, "", 1)
if err == nil && len(hits) == 0 {
// symbol genuinely absent; fix name first
} Type guard
null
Try / catch
if err != nil {
if strings.Contains(err.Error(), "not found in grep") { /* verify spelling or search wider */ }
} Prevention
- Confirm exact identifier spelling and case
- Account for gitignore/crushignore exclusions hiding matches
- Check whether the symbol only exists in vendored/generated code
When it happens
Trigger: Calling resolveSymbol for an identifier that literally does not appear in the working directory files — misspelled symbol, symbol defined in an ignored/vendor directory excluded by gitignore/crushignore, or only appearing in binary files grep skips.
Common situations: Typos in the symbol name, symbol defined in generated or vendored code filtered out by the walker, symbol renamed in the working tree while an old session still references it.
Related errors
- failed to search for symbol: %w
- skill not found
- invalid regex pattern: %w
- invalid include pattern: %w
- path does not exist: %s
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/8c3c343b2f5d595e.
Report an issue: GitHub.