{"record":{"id":"7f5cb4f8a0b0ab13","repo":"fish2018/pansou","slug":"s-d-7f5cb4","errorCode":null,"errorMessage":"[%s] 请求返回状态码: %d","messagePattern":"\\[(.+?)\\] 请求返回状态码: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/ikantv/ikantv.go","lineNumber":90,"sourceCode":"\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, searchURL, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] 创建请求失败: %w\", p.Name(), err)\n\t}\n\n\treq.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\")\n\treq.Header.Set(\"Accept\", \"application/json, text/plain, */*\")\n\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9,en;q=0.8\")\n\treq.Header.Set(\"Connection\", \"keep-alive\")\n\treq.Header.Set(\"Referer\", defaultReferer)\n\n\tresp, err := p.doRequestWithRetry(req, client)\n\tif err != nil {\n\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 apiResp apiResponse\n\tif err := json.Unmarshal(body, &apiResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] JSON解析失败: %w\", p.Name(), err)\n\t}\n\tif apiResp.Code != 0 {\n\t\treturn nil, fmt.Errorf(\"[%s] API错误: %s\", p.Name(), apiResp.Message)\n\t}\n\n\tresults := convertResults(apiResp.Data)\n\treturn plugin.FilterResultsByKeyword(results, keyword), nil\n}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/ikantv/ikantv.go#L72-L108","documentation":"Status error in ikantv's doSearch (plugin/ikantv/ikantv.go:90): the search endpoint responded after retries with a non-200 status. The request and headers were accepted at transport level but the site refused the search (rate limit, block, or endpoint change).","triggerScenarios":"resp.StatusCode != http.StatusOK: 403/429 from anti-bot or rate limiting, 404 because the search path changed, 5xx from upstream server errors.","commonSituations":"默认 Referer 失效触发防盗链；服务端 5xx。","solutions":["Check the logged status code: 403/429 imply blocking or rate limiting — reduce request frequency or change IP; 404/5xx imply site changes or upstream outage.","Verify the plugin's search URL/path still matches the current ikantv API and update it if the site changed.","Ensure the User-Agent/Referer headers still pass the site's bot checks.","Retry later if the status is 5xx — it is usually a transient upstream problem."],"exampleFix":"// before\nif resp.StatusCode != http.StatusOK {\n\treturn nil, fmt.Errorf(\"[%s] 请求返回状态码: %d\", p.Name(), resp.StatusCode)\n}\n// after\nif resp.StatusCode != http.StatusOK {\n\tbodySnippet, _ := io.ReadAll(io.LimitReader(resp.Body, 500))\n\treturn nil, fmt.Errorf(\"[%s] 请求返回状态码: %d, body: %s\", p.Name(), resp.StatusCode, string(bodySnippet))\n}","handlingStrategy":"retry","validationCode":"// pre-flight: does the upstream still serve the search path?\nresp, err := client.Head(searchURL)\nif err == nil && (resp.StatusCode == 403 || resp.StatusCode == 429) {\n\treturn fmt.Errorf(\"ikantv is blocking this client (HTTP %d) — adjust rate/IP before searching\", resp.StatusCode)\n}","typeGuard":null,"tryCatchPattern":"results, err := p.doSearch(ctx, keyword)\nif err != nil {\n\tvar statusErr *statusCodeError // if you wrap statuses in a typed error\n\tif errors.As(err, &statusErr) {\n\t\tswitch {\n\t\tcase statusErr.Code == 429 || statusErr.Code == 403:\n\t\t\t// back off / change IP / slow down\n\t\tcase statusErr.Code >= 500:\n\t\t\t// transient: retry later\n\t\tdefault:\n\t\t\t// likely site change: check path/headers\n\t\t}\n\t}\n}","preventionTips":["Respect rate limits to avoid 429/403 from anti-bot layers","Keep User-Agent/Referer headers realistic and current","Re-check the search path after any upstream site redesign","Classify by status code: 5xx retry, 4xx fix request, 403/429 back off"],"tags":["http","go","status-code","upstream"],"backgroundTag":"http-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"}