Tencent/WeKnora · error
Metaso response exceeds %d bytes
Error message
Metaso response exceeds %d bytes
What it means
Returned by readMetasoResponseBody when the response body exceeds maxMetasoResponseBytes (detected by reading one byte past the cap). The payload is abnormally large — likely an error page or runaway result set — and is rejected instead of loading it into memory.
Source
Thrown at internal/infrastructure/web_search/metaso.go:149
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 != "" {
return fmt.Errorf("Metaso API returned status %d: %s", statusCode, detail)
}
}View on GitHub (pinned to 988cbb0330)
Solutions
- Reduce maxResults to shrink the expected payload
- Investigate why Metaso returned an oversized body (log a truncated sample)
- Raise the limit only if legitimate responses are being cut off
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/infrastructure/web_search/metaso.go:149 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/7262a2de997e33ba.
Report an issue: GitHub.