{"record":{"id":"dd22058e4c598822","repo":"binary-husky/gpt_academic","slug":"str-e-dd2205","errorCode":null,"errorMessage":"分析查询失败: {str(e)}","messagePattern":"分析查询失败: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"crazy_functions/paper_fns/auto_git/query_analyzer.py","lineNumber":304,"sourceCode":"            print(f\"最低星标数: {min_stars}\")\n            print(f\"英文GitHub参数: {english_github_query}\")\n            print(f\"中文GitHub参数: {chinese_github_query}\")\n            print(f\"特定仓库: {repo_id}\")\n\n            # 更新返回的 SearchCriteria，包含中英文查询\n            return SearchCriteria(\n                query_type=query_type,\n                main_topic=main_topic,\n                sub_topics=sub_topics,\n                language=language,\n                min_stars=min_stars,\n                github_params=github_params,\n                original_query=query,\n                repo_id=repo_id\n            )\n\n        except Exception as e:\n            raise Exception(f\"分析查询失败: {str(e)}\")\n\n    def _normalize_query_type(self, query_type: str, query: str) -> str:\n        \"\"\"规范化查询类型\"\"\"\n        if query_type in [\"repo\", \"code\", \"user\", \"topic\"]:\n            return query_type\n\n        query_lower = query.lower()\n        for type_name, keywords in self.valid_types.items():\n            for keyword in keywords:\n                if keyword in query_lower:\n                    return type_name\n\n        query_type_lower = query_type.lower()\n        for type_name, keywords in self.valid_types.items():\n            for keyword in keywords:\n                if keyword in query_type_lower:\n                    return type_name\n","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/crazy_functions/paper_fns/auto_git/query_analyzer.py#L286-L322","documentation":"A catch-all wrapper: the analyze method wraps its entire body in try/except and re-raises any inner failure as '分析查询失败: {original message}'. Every error inside analysis — missing responses (61), bad tags (62), conversion failures (60), SearchCriteria construction errors — surfaces through this single message. The inner exception text is preserved, so read the suffix to find the real cause; the original traceback is lost.","triggerScenarios":"Any exception raised inside the analyze() method body: LLM call failures, tag extraction failures, None responses, invalid github_params structures, keyword argument mismatches when building SearchCriteria.","commonSituations":"First error users see when any part of the auto-git query analysis pipeline breaks; commonly triggered transitively by errors 60-62 when the LLM output is malformed.","solutions":["Read the text after '分析查询失败:' — it names the actual inner error (e.g. '无法提取query_type标签内容' means fix error 62)","Reproduce with the same query string and inspect the debug prints emitted just before the raise","Change the wrapper to 'raise ... from e' (or log e.__class__ and traceback) to keep the root cause","Fix the inner error per its own diagnosis; the wrapper itself needs no direct fix"],"exampleFix":"// before\nexcept Exception as e:\n    raise Exception(f\"分析查询失败: {str(e)}\")\n\n// after\nexcept Exception as e:\n    raise Exception(f\"分析查询失败: {str(e)}\") from e","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    criteria = analyzer.analyze(query)\nexcept Exception as e:\n    logger.exception(\"query analysis failed\")  # full traceback; the wrapper loses it\n    raise","preventionTips":["Treat this message as a routing prefix — always diagnose the suffix, never the wrapper","Patch the wrapper to 'raise ... from e' so tracebacks survive","Log the input query alongside the failure for reproduction"],"tags":["wrapper","query-analyzer","error-chaining","llm"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}