Tencent/WeKnora · error
query is empty
Error message
query is empty
What it means
Input validation at the top of OllamaProvider.Search: the query string has zero length, so there is nothing to send to the Ollama Cloud API. The search aborts before max-results clamping or request building; callers should treat it as a caller-side bug rather than a provider failure.
Source
Thrown at internal/infrastructure/web_search/ollama.go:62
baseURL: defaultOllamaWebSearchURL, // Hardcoded — not tenant-configurable
apiKey: params.APIKey,
}, nil
}
// Name returns the provider name
func (p *OllamaProvider) Name() string {
return "ollama"
}
// Search performs a web search using Ollama Cloud API
func (p *OllamaProvider) Search(
ctx context.Context,
query string,
maxResults int,
includeDate bool,
) ([]*types.WebSearchResult, error) {
if len(query) == 0 {
return nil, fmt.Errorf("query is empty")
}
if maxResults <= 0 {
maxResults = defaultOllamaResults
}
// Ollama限制最多10个结果
if maxResults > maxOllamaResults {
maxResults = maxOllamaResults
}
logger.Infof(ctx, "[WebSearch][Ollama] query=%q maxResults=%d url=%s", query, maxResults, p.baseURL)
req, err := p.buildRequest(ctx, query, maxResults)
if err != nil {
return nil, err
}
results, err := p.doSearch(ctx, req)
if err != nil {View on GitHub (pinned to 988cbb0330)
Solutions
- Ensure callers supply a non-empty query
- Guard the search invocation when the derived query is blank
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/infrastructure/web_search/ollama.go:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/bd98d9ed5be1c678.
Report an issue: GitHub.