{"record":{"id":"8ba7c59067215e1e","repo":"fish2018/pansou","slug":"token-w","errorCode":null,"errorMessage":"获取token失败: %w","messagePattern":"获取token失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/xys/xys.go","lineNumber":103,"sourceCode":"func (p *XysPlugin) Description() string {\n\treturn Description\n}\n\n// Search 搜索接口\nfunc (p *XysPlugin) Search(keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {\n\treturn p.searchImpl(&http.Client{Timeout: 30 * time.Second}, keyword, ext)\n}\n\n// searchImpl 搜索实现\nfunc (p *XysPlugin) searchImpl(client *http.Client, keyword string, ext map[string]interface{}) ([]model.SearchResult, error) {\n\tif p.debugMode {\n\t\tlog.Printf(\"[XYS] 开始搜索: %s\", keyword)\n\t}\n\n\t// 第一步：获取token\n\ttoken, err := p.getToken(client, keyword)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"获取token失败: %w\", err)\n\t}\n\n\tif p.debugMode {\n\t\tlog.Printf(\"[XYS] 获取到token: %s\", token[:10]+\"...\")\n\t}\n\n\t// 第二步：执行搜索\n\tresults, err := p.executeSearch(client, token, keyword)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"执行搜索失败: %w\", err)\n\t}\n\n\tif p.debugMode {\n\t\tlog.Printf(\"[XYS] 搜索完成，获取到 %d 个结果\", len(results))\n\t}\n\n\treturn results, nil\n}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/xys/xys.go#L85-L121","documentation":"Wrapper at the top of xys searchImpl: the pre-search token request (getToken) failed — transport error, non-200, or token extraction failure. Without a token no search can be issued, so the whole search aborts.","triggerScenarios":"Thrown at plugin/xys/xys.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped cause from getToken","Retry the token fetch with backoff","If token endpoint changed, update getToken"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}