{"record":{"id":"0c36a18209b6b43e","repo":"binary-husky/gpt_academic","slug":"i-1","errorCode":null,"errorMessage":"未收到第 {i + 1} 个响应","messagePattern":"未收到第 (.+?) 个响应","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"crazy_functions/paper_fns/auto_git/query_analyzer.py","lineNumber":226,"sourceCode":"                sys_prompt_array=sys_prompts,\n                max_workers=3\n            )\n\n            # 从收集的响应中提取我们需要的内容\n            extracted_responses = []\n            for i in range(len(prompts)):\n                if (i * 2 + 1) < len(responses):\n                    response = responses[i * 2 + 1]\n                    if response is None:\n                        raise Exception(f\"Response {i} is None\")\n                    if not isinstance(response, str):\n                        try:\n                            response = str(response)\n                        except:\n                            raise Exception(f\"Cannot convert response {i} to string\")\n                    extracted_responses.append(response)\n                else:\n                    raise Exception(f\"未收到第 {i + 1} 个响应\")\n\n            # 解析基本信息\n            query_type = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], \"query_type\")\n            if not query_type:\n                print(\n                    f\"Debug - Failed to extract query_type. Response was: {extracted_responses[self.BASIC_QUERY_INDEX]}\")\n                raise Exception(\"无法提取query_type标签内容\")\n            query_type = query_type.lower()\n\n            main_topic = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], \"main_topic\")\n            if not main_topic:\n                print(f\"Debug - Failed to extract main_topic. Using query as fallback.\")\n                main_topic = query\n\n            query_type = self._normalize_query_type(query_type, query)\n\n            # 提取子主题\n            sub_topics = []","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/crazy_functions/paper_fns/auto_git/query_analyzer.py#L208-L244","documentation":"Raised when the collected responses list is shorter than expected: the loop expects a response at index i*2+1 for every prompt i (multiplexed prompt/response interleaving), and the else-branch fires when that index is out of range. It means at least one of the parallel LLM calls returned nothing — the list has fewer than 2*len(prompts) entries.","triggerScenarios":"One or more parallel LLM requests fail silently or the multiplexer drops failed requests from the result list; mismatch between the number of prompts sent and responses collected (prompts changed but responses came from an earlier batch).","commonSituations":"API rate limiting causing some parallel calls to be dropped; timeout on one of the requests; a refactor that changed the prompt count without updating response handling; upstream returning early on first error.","solutions":["Log len(prompts) and len(responses) right before the loop to see how many responses are missing","Check the multiplexed request call above for silently swallowed exceptions (failed calls should either raise or insert a placeholder)","Retry the whole analysis call — transient network/API failures often cause a short response list","If failures are persistent, reduce parallelism of the LLM requests to avoid rate-limit drops"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if len(responses) < 2 * len(prompts):\n    # resend only the missing prompts instead of failing the whole analysis\n    missing = [p for i, p in enumerate(prompts) if (i*2+1) >= len(responses)]\n    responses = resend_and_merge(responses, missing)","typeGuard":null,"tryCatchPattern":"try:\n    analyzer.analyze(query)\nexcept Exception as e:\n    if \"未收到第\" in str(e):\n        time.sleep(2)\n        analyzer.analyze(query)  # one retry; transient drops are the usual cause","preventionTips":["Assert len(responses) == 2 * len(prompts) immediately after the multiplexed call","Make parallel request helpers either return exactly one result per prompt (None on failure) or raise","Limit LLM call parallelism to stay under provider rate limits"],"tags":["llm","parallel-requests","query-analyzer","missing-response"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}