charmbracelet/crush · error

no LSP client handles any file matching '%s'

Error message

no LSP client handles any file matching '%s'

What it means

Even when grep finds textual matches, resolveSymbolResults must map each match to an LSP client whose language handlers cover the matched file. If findLSPClient returns nil for every matched file, results is empty and this error is thrown: no configured LSP server handles the file type.

Source

Thrown at internal/agent/tools/lsp_helpers.go:88

		if err != nil {
			continue
		}

		client := findLSPClient(lspManager, absPath)
		if client == nil {
			continue
		}

		results = append(results, &resolvedSymbol{
			client: client,
			path:   absPath,
			line:   match.lineNum,
			char:   match.charNum + getSymbolOffset(symbol),
		})
	}

	if len(results) == 0 {
		return nil, fmt.Errorf("no LSP client handles any file matching '%s'", symbol)
	}
	return results, nil
}

// findLSPClient returns the first LSP client that handles the given file path.
func findLSPClient(lspManager *lsp.Manager, filePath string) *lsp.Client {
	if abs, err := filepath.Abs(filePath); err == nil {
		filePath = abs
	}
	for c := range lspManager.Clients().Seq() {
		if c.HandlesFile(filePath) {
			return c
		}
	}
	return nil
}

// collectAffectedFiles extracts all unique file paths from a WorkspaceEdit.

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Add an lsp block for the language to crushrc (e.g. lsp gopls for Go).
  2. Verify the LSP server binary is installed and starts (check logs).
  3. Search in files of a handled type, or navigate to the definition file directly and operate there.
  4. Confirm LSP auto-discovery found the server for the project.

Example fix

// before
# crushrc: no lsp configured
# after
lsp gopls {
    command gopls
}
Defensive patterns

Strategy: fallback

Validate before calling

if findLSPClient(lspManager, filePath) == nil {
    return errors.New("no LSP client for " + filepath.Ext(filePath))
}

Type guard

null

Try / catch

if err != nil {
    if strings.Contains(err.Error(), "no LSP client handles") { /* configure LSP for that language */ }
}

Prevention

When it happens

Trigger: Resolving a symbol whose occurrences are all in file types with no LSP configured (e.g. a .md or .txt file when only a Go LSP is registered), or when no LSP servers are configured at all.

Common situations: Missing lsp configuration in crushrc for the relevant language; symbol appears only in docs/comments of unhandled file types; LSP for the language failed to start so no client is registered.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/d66f326464420dfe. Report an issue: GitHub.