Tencent/WeKnora · error
Metaso API returned status %d
Error message
Metaso API returned status %d
What it means
Returned by metasoHTTPError when the Metaso API returns a non-2xx status but the body yields no usable error detail (not JSON with message/error, or an empty body) — a sentinel form of the same HTTP failure carrying only the status code.
Source
Thrown at internal/infrastructure/web_search/metaso.go:173
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)
}
}
detail := strings.TrimSpace(string(body))
if len(detail) > 4096 {
detail = detail[:4096]
}
if detail == "" {
return fmt.Errorf("Metaso API returned status %d", statusCode)
}
return fmt.Errorf("Metaso API returned status %d: %s", statusCode, detail)
}
func parseMetasoDate(value string) (time.Time, bool) {
for _, layout := range []string{time.RFC3339Nano, "2006-01-02 15:04:05", "2006-01-02"} {
if parsed, err := time.Parse(layout, strings.TrimSpace(value)); err == nil {
return parsed, true
}
}
return time.Time{}, false
}
type metasoSearchRequest struct {
Query string `json:"q"`
Scope string `json:"scope"`
Size int `json:"size"`
IncludeSummary bool `json:"includeSummary"`View on GitHub (pinned to 988cbb0330)
Solutions
- Correlate the status code with Metaso API documentation
- Enable request logging to capture the raw response for diagnosis
- Retry on 5xx; fix credentials/parameters on 4xx
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/infrastructure/web_search/metaso.go:173 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/d0cd218c5a020698.
Report an issue: GitHub.