{"record":{"id":"0e30b2667badc43c","repo":"fish2018/pansou","slug":"buildid","errorCode":null,"errorMessage":"未找到buildId","messagePattern":"未找到buildId","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/pansearch/pansearch.go","lineNumber":447,"sourceCode":"\t\t// 如果读取响应失败，但有旧的缓存，使用旧的缓存（优雅降级）\n\t\tif buildIdCache != \"\" {\n\t\t\t// fmt.Printf(\"读取响应失败，使用旧的buildId: %v\\n\", err)\n\t\t\treturn buildIdCache, nil\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"读取响应失败: %w\", err)\n\t}\n\tbody := bodyBuilder.String()\n\n\t// 使用提取函数获取 buildId\n\tbuildId := extractBuildId(body)\n\n\t// 如果提取失败，但有旧的缓存，使用旧的缓存（优雅降级）\n\tif buildId == \"\" {\n\t\tif buildIdCache != \"\" {\n\t\t\t// fmt.Println(\"未找到buildId，使用旧的buildId\")\n\t\t\treturn buildIdCache, nil\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"未找到buildId\")\n\t}\n\n\t// 更新缓存\n\tbuildIdCache = buildId\n\tbuildIdCacheTime = time.Now()\n\n\treturn buildId, nil\n}\n\n// getBaseURL 获取完整的API基础URL\nfunc (p *PanSearchAsyncPlugin) getBaseURL(client *http.Client) (string, error) {\n\tbuildId, err := p.getBuildId(client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn fmt.Sprintf(BaseURLTemplate, buildId), nil\n}","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/pansearch/pansearch.go#L429-L465","documentation":"getBuildId received a 200 response but extractBuildId could not find a buildId string in the HTML/JS body. It fails only when buildIdCache is empty; otherwise the previous cached buildId is returned via graceful degradation.","triggerScenarios":"Upstream page loaded fine but its markup changed (the regex/extract pattern no longer matches), or the response was a challenge/placeholder page with no buildId, on a call where no cached buildId exists.","commonSituations":"Upstream site redeployed and changed how buildId is embedded (script tag moved/renamed), bot-protection interstitial page returned instead of the real page, or a CDN served an error page with 200 status.","solutions":["Inspect the response body and update extractBuildId's pattern to match the new markup.","Clear the empty/stale cache state and retry after the upstream stabilizes.","Check whether a bot-protection page was returned; add/refresh appropriate headers or cookies.","Pin/report the upstream change; the cache will keep searches working only until it is cleared."],"exampleFix":"// before\nbuildId := extractBuildId(body)\n// after\nbuildId := extractBuildId(body)\nif buildId == \"\" {\n    log.Printf(\"buildId extraction failed, body head: %.200s\", body)\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"未找到buildId\") {\n    // upstream markup/behavior changed; treat as upstream outage and fall back\n    return cachedOrEmptyResults, nil\n}","preventionTips":["Watch for repeated occurrences — they mean the extractBuildId pattern needs updating after an upstream redeploy","Keep the buildId cache warm so degradation paths stay available","Test the plugin after upstream site releases"],"tags":["parse","upstream","buildid","unexpected-response"],"backgroundTag":"unexpected-api-response-shape","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"}