Tencent/WeKnora · error
failed to read Metaso response: %w
Error message
failed to read Metaso response: %w
What it means
I/O error in readMetasoResponseBody: reading the Metaso response stream (capped at maxMetasoResponseBytes+1 via LimitReader) failed before completion. The %w wraps the io error (truncated connection, reset); it fires when the body cannot be fully read, distinct from later size-limit and parse handling.
Source
Thrown at internal/infrastructure/web_search/metaso.go:146
result := &types.WebSearchResult{Title: item.Title, URL: item.Link, Snippet: snippet, Content: item.RawContent, Source: "metaso"}
if includeDate {
if publishedAt, ok := parseMetasoDate(item.Date); ok {
result.PublishedAt = &publishedAt
}
}
results = append(results, result)
if len(results) >= maxResults {
break
}
}
logger.Infof(ctx, "[WebSearch][Metaso] returned %d results", len(results))
return results, nil
}
func readMetasoResponseBody(reader io.Reader) ([]byte, error) {
body, err := io.ReadAll(io.LimitReader(reader, maxMetasoResponseBytes+1))
if err != nil {
return nil, fmt.Errorf("failed to read Metaso response: %w", err)
}
if len(body) > maxMetasoResponseBytes {
return nil, fmt.Errorf("Metaso response exceeds %d bytes", maxMetasoResponseBytes)
}
return body, nil
}
func metasoHTTPError(statusCode int, body []byte) error {
var apiError struct {
Message string `json:"message"`
Error string `json:"error"`
}
if json.Unmarshal(body, &apiError) == nil {
detail := strings.TrimSpace(apiError.Message)
if detail == "" {
detail = strings.TrimSpace(apiError.Error)
}
if detail != "" {View on GitHub (pinned to 988cbb0330)
Solutions
- Check network stability to the Metaso endpoint
- Retry the search; partial reads are typically transient
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/infrastructure/web_search/metaso.go:146 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/ec852e2d302c2eb7.
Report an issue: GitHub.