中文版提示词
请扮演资深软件工程师,帮助我诊断并修复一个运行时错误。我将提供以下信息:

  • 报错类型:[粘贴具体报错类型,如 TypeError、ReferenceError、Java NullPointerException 等]

  • 堆栈信息:[粘贴堆栈跟踪,包含文件及行号]

  • 相关代码:[粘贴代码块,需注明编程语言]

请完成以下任务:

  1. 分析错误的根本原因(深入代码逻辑或环境层面)。

  2. 给出最小改动的修复方案(仅修改必要部分,不重构无关代码)。

  3. 如果涉及异步逻辑、竞态条件或并发问题,请额外说明潜在风险和预防措施。

直接输出分析、修复方案及额外说明,无需其他内容。


英文版提示词(English Version Prompt)
Please act as a senior software engineer to help me diagnose and fix a runtime error. I will provide:

  • Error Type: [paste the specific error type, e.g., TypeError, ReferenceError, Java NullPointerException, etc.]

  • Stack Trace: [paste the stack trace with file names and line numbers]

  • Relevant Code: [paste the code block, specifying the programming language]

Please complete the following:

  1. Analyze the root cause of the error (at code logic or environment level).

  2. Provide a minimal‑change fix (only modify what is necessary, no refactoring of unrelated code).

  3. If the issue involves asynchronous logic, race conditions, or concurrency, additionally explain the potential risks and preventive measures.

Output directly the analysis, fix plan, and extra notes, without any other content.