binary-husky/gpt_academic · error · Exception
未收到第 {i + 1} 个响应
Error message
未收到第 {i + 1} 个响应 What it means
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.
Source
Thrown at crazy_functions/paper_fns/auto_git/query_analyzer.py:226
sys_prompt_array=sys_prompts,
max_workers=3
)
# 从收集的响应中提取我们需要的内容
extracted_responses = []
for i in range(len(prompts)):
if (i * 2 + 1) < len(responses):
response = responses[i * 2 + 1]
if response is None:
raise Exception(f"Response {i} is None")
if not isinstance(response, str):
try:
response = str(response)
except:
raise Exception(f"Cannot convert response {i} to string")
extracted_responses.append(response)
else:
raise Exception(f"未收到第 {i + 1} 个响应")
# 解析基本信息
query_type = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], "query_type")
if not query_type:
print(
f"Debug - Failed to extract query_type. Response was: {extracted_responses[self.BASIC_QUERY_INDEX]}")
raise Exception("无法提取query_type标签内容")
query_type = query_type.lower()
main_topic = self._extract_tag(extracted_responses[self.BASIC_QUERY_INDEX], "main_topic")
if not main_topic:
print(f"Debug - Failed to extract main_topic. Using query as fallback.")
main_topic = query
query_type = self._normalize_query_type(query_type, query)
# 提取子主题
sub_topics = []View on GitHub (pinned to d6bde0fa54)
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
Defensive patterns
Strategy: retry
Validate before calling
if len(responses) < 2 * len(prompts):
# resend only the missing prompts instead of failing the whole analysis
missing = [p for i, p in enumerate(prompts) if (i*2+1) >= len(responses)]
responses = resend_and_merge(responses, missing) Try / catch
try:
analyzer.analyze(query)
except Exception as e:
if "未收到第" in str(e):
time.sleep(2)
analyzer.analyze(query) # one retry; transient drops are the usual cause Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Response {i} is None
- 未收到第 {i + 1} 个响应
- Cannot convert response {i} to string
- 无法提取query_type标签内容
- 分析查询失败: {str(e)}
AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14).
Data as JSON: /api/errors/0c36a18209b6b43e.
Report an issue: GitHub.