{"record":{"id":"42fffe756ea4e984","repo":"fish2018/pansou","slug":"s-42fffe","errorCode":null,"errorMessage":"[%s] 搜索接口返回失败","messagePattern":"\\[(.+?)\\] 搜索接口返回失败","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/lou1/lou1.go","lineNumber":210,"sourceCode":"\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求失败: %w\", p.Name(), err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索返回状态码: %d\", p.Name(), resp.StatusCode)\n\t}\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 读取搜索响应失败: %w\", p.Name(), err)\n\t}\n\n\tvar payload lou1SearchResponse\n\tif err := jsonutil.Unmarshal(body, &payload); err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 解析搜索 JSON 失败: %w\", p.Name(), err)\n\t}\n\tif !payload.OK {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索接口返回失败\", p.Name())\n\t}\n\n\tthreads := make([]searchThread, 0, minInt(searchLimit, len(payload.Data.Hits)))\n\tfor _, hit := range payload.Data.Hits {\n\t\tif len(threads) >= searchLimit {\n\t\t\tbreak\n\t\t}\n\t\ttitle := strings.TrimSpace(hit.Subject)\n\t\tthreadURL := toAbsoluteURL(hit.ThreadURL)\n\t\tif title == \"\" || threadURL == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tthreads = append(threads, searchThread{\n\t\t\tTitle: title,\n\t\t\tURL:   threadURL,\n\t\t})\n\t}\n\treturn threads, nil","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/lou1/lou1.go#L192-L228","documentation":"The JSON decoded successfully but the payload's OK flag is false, meaning the Lou1 search API itself reported a business-logic failure. The plugin treats this as an explicit upstream rejection of the search.","triggerScenarios":"jsonutil.Unmarshal succeeds, then payload.OK == false — the API responded but with an error/failure status in the envelope.","commonSituations":"Keyword violates upstream search constraints; API key/token absent or expired; search endpoint deprecated in favor of a new version; upstream rate limiting surfaced as an in-band failure flag.","solutions":["Log the full payload — many APIs include an error message alongside ok=false","Check whether the API now requires auth/keys and add them to headers","Verify the API endpoint version is still supported; migrate if deprecated","Inspect request parameters (keyword, page, limit) for values the API rejects"],"exampleFix":"// before\nif !payload.OK { return nil, fmt.Errorf(\"search failed\") }\n// after\nif !payload.OK {\n    return nil, fmt.Errorf(\"lou1 api failure: code=%d msg=%s\", payload.Code, payload.Message)\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := lou1.Search(kw)\nif err != nil && strings.Contains(err.Error(), \"搜索接口返回失败\") {\n    log.Printf(\"lou1 api rejected search; payload msg: %v\", payloadMsg(err))\n    return tryAlternatePlugins(kw)\n}","preventionTips":["Capture and log the API's own error message/code next to the ok flag","Watch for API version deprecations and migrate endpoints proactively","Validate request parameters against the API's documented constraints"],"tags":["api","upstream","response"],"backgroundTag":"api-error-response","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}