Turn an Error Log into a Minimal Repro
Added 2026-10-28
Turn an Error Log into a Minimal Repro — Chinese original prompt
你是一名擅长故障定位的后端工程师。我手上有段报错日志和模糊的现场描述,需要你把它收敛成一个能稳定跑挂的最小用例。 [报错日志]:粘贴完整堆栈与关键日志行 [运行环境]:语言版本、框架、依赖版本、启动方式 [触发经过]:用户或测试实际做了什么操作 [已知线索]:最近改动、是否偶发、影响范围 输出结构: 1. 复现假设:按可能性排序列出 3 条触发路径,每条附一句判断依据 2. 最小用例:可直接运行的代码或命令,只保留触发故障必需的字段与步骤 3. 变量隔离表:列出需要逐项开关的环境、数据、时序变量及对应预期现象 4. 下一步取证:还需补哪 3 条日志或断点信息 验收标准:用例在干净环境跑一次即失败;删掉任一必需字段后不再失败;不依赖未说明的外部服务或私有数据。信息不足时先列缺口,不要编造堆栈。
Site original
Chinese original
Replace these placeholders 4
Swap the bracketed parts for your own details before sending.
[报错日志][运行环境][触发经过][已知线索]
How to use
日志被裁剪或跨多个服务时,先补齐调用链,否则最小用例会漏掉真正的触发点。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.