{"record":{"id":"ac209d9f9dc441bb","repo":"fish2018/pansou","slug":"s-success-v-code-d","errorCode":null,"errorMessage":"[%s] 搜索接口返回异常: success=%v code=%d","messagePattern":"\\[(.+?)\\] 搜索接口返回异常: success=(.+?) code=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/lingjisp/lingjisp.go","lineNumber":202,"sourceCode":"\tparams := url.Values{}\n\tparams.Set(\"app_id\", lingjiAppID)\n\tparams.Set(\"identity\", lingjiIdentity)\n\tparams.Set(\"sb\", keyword)\n\tparams.Set(\"page\", \"1\")\n\tparams.Set(\"limit\", \"20\")\n\n\tapiURL := lingjiAPIBase + \"getVideoList?\" + params.Encode()\n\tbody, err := doLingjiGET(client, apiURL, lingjiSearchTimeout)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索请求失败: %w\", p.Name(), err)\n\t}\n\n\tvar resp lingjiSearchResponse\n\tif err := json.Unmarshal(body, &resp); err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 解析搜索响应失败: %w\", p.Name(), err)\n\t}\n\tif !resp.Success || resp.Code != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"[%s] 搜索接口返回异常: success=%v code=%d\", p.Name(), resp.Success, resp.Code)\n\t}\n\n\titems := resp.Data.Data\n\tif len(items) == 0 {\n\t\titems = resp.Data.List\n\t}\n\treturn dedupeLingjiItems(items), nil\n}\n\nfunc (p *LingjiPlugin) fetchDetail(client *http.Client, doubID int) (lingjiVideoItem, error) {\n\tparams := url.Values{}\n\tparams.Set(\"app_id\", lingjiAppID)\n\tparams.Set(\"identity\", lingjiIdentity)\n\tparams.Set(\"id\", fmt.Sprintf(\"%d\", doubID))\n\n\tapiURL := lingjiAPIBase + \"getVideoDetail?\" + params.Encode()\n\tbody, err := doLingjiGET(client, apiURL, lingjiDetailTimeout)\n\tif err != nil {","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/lingjisp/lingjisp.go#L184-L220","documentation":"The getVideoList JSON parsed fine but the logical envelope check failed: either resp.Success was false or resp.Code was not HTTP 200. The API itself reported an error condition, so fetchSearchItems aborts with the success flag and code included for diagnosis.","triggerScenarios":"JSON body matched lingjiSearchResponse but the payload said success=false or code != 200 — e.g. invalid/missing parameters, API key/identity rejected, rate limited by the upstream API, or empty/invalid search keyword handling server-side.","commonSituations":"lingjiIdentity or other query params are stale/invalid after an API update; upstream throttling returns coded errors; keyword rejected by server-side validation; API moved to a new error-code scheme.","solutions":["Log the full response body when success=false to read the API's error message field","Verify lingjiIdentity, keyword encoding, and other query params match the current API contract","Add retry with backoff for transient upstream errors (rate limiting)","Update the plugin if the API changed its success/code semantics","Check whether the API requires auth headers or cookies that have expired"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-validate request params the API is known to reject\nif keyword == \"\" || lingjiIdentity == \"\" {\n    return fmt.Errorf(\"搜索参数缺失: keyword/identity\")\n}","typeGuard":null,"tryCatchPattern":"items, err := fetchSearchItems(...)\nvar apiErr *LingjiAPIError\nif errors.As(err, &apiErr) {\n    log.Printf(\"lingjisp 上游拒绝: success=%v code=%d\", apiErr.Success, apiErr.Code)\n    if apiErr.Code == http.StatusTooManyRequests {\n        time.Sleep(cooldown)\n        // retry once\n    }\n    return emptyResults, nil\n}","preventionTips":["Log the full response body when success=false to capture the API message","Keep lingjiIdentity and query params current with the API","Rate-limit detail/search bursts to avoid coded throttling errors","Track API announcements for error-code scheme changes"],"tags":["api","upstream","validation"],"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"}