{"record":{"id":"d0cd218c5a020698","repo":"Tencent/WeKnora","slug":"metaso-api-returned-status-d","errorCode":null,"errorMessage":"Metaso API returned status %d","messagePattern":"Metaso API returned status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/web_search/metaso.go","lineNumber":173,"sourceCode":"\tvar apiError struct {\n\t\tMessage string `json:\"message\"`\n\t\tError   string `json:\"error\"`\n\t}\n\tif json.Unmarshal(body, &apiError) == nil {\n\t\tdetail := strings.TrimSpace(apiError.Message)\n\t\tif detail == \"\" {\n\t\t\tdetail = strings.TrimSpace(apiError.Error)\n\t\t}\n\t\tif detail != \"\" {\n\t\t\treturn fmt.Errorf(\"Metaso API returned status %d: %s\", statusCode, detail)\n\t\t}\n\t}\n\tdetail := strings.TrimSpace(string(body))\n\tif len(detail) > 4096 {\n\t\tdetail = detail[:4096]\n\t}\n\tif detail == \"\" {\n\t\treturn fmt.Errorf(\"Metaso API returned status %d\", statusCode)\n\t}\n\treturn fmt.Errorf(\"Metaso API returned status %d: %s\", statusCode, detail)\n}\n\nfunc parseMetasoDate(value string) (time.Time, bool) {\n\tfor _, layout := range []string{time.RFC3339Nano, \"2006-01-02 15:04:05\", \"2006-01-02\"} {\n\t\tif parsed, err := time.Parse(layout, strings.TrimSpace(value)); err == nil {\n\t\t\treturn parsed, true\n\t\t}\n\t}\n\treturn time.Time{}, false\n}\n\ntype metasoSearchRequest struct {\n\tQuery             string `json:\"q\"`\n\tScope             string `json:\"scope\"`\n\tSize              int    `json:\"size\"`\n\tIncludeSummary    bool   `json:\"includeSummary\"`","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/web_search/metaso.go#L155-L191","documentation":"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.","triggerScenarios":"Thrown at internal/infrastructure/web_search/metaso.go:173 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}