Back to Rules

🧠 Cursor Rule — Paste Full Error Logs

OfficialPopular
CursorDebugging & Fixes
cursordebuggingerror-handlingtroubleshooting

Summary

Provide complete error logs, stack traces, and contextual metadata when asking the Agent for debugging help. Full logs allow deterministic root cause analysis and reduce back-and-forth.

Objectives

  • Provide the full error message and stack trace.
  • Include context: input data, environment, recent code changes.
  • Make the failure reproducible for the Agent with minimal guessing.

Principles

1. More context beats less context. Partial logs increase investigation time.

2. Include environment and runtime metadata to rule out platform differences.

3. Show the exact sequence of steps that led to the error whenever possible.

4. Redact secrets but preserve all technical detail needed to reproduce.

Implementation Pattern

Step 1 — Capture the full error output

  • Copy the terminal or browser console output exactly, including timestamp lines and stack traces.
  • Include the full error name and message as the top lines.

Step 2 — Provide environment and runtime metadata

  • Node or browser version, OS, CPU, memory, and relevant config values.
  • Package versions for critical dependencies.

Step 3 — Add the minimal reproduction context

  • The exact input or request that triggered the error.
  • Any recent code changes, deployment events, or configuration changes.

Step 4 — Include related artifacts for the Agent to run

  • Minimal reproduction snippet or a direct reference to the failing file and line numbers.
  • Example logs of surrounding operations if the error is part of a sequence.

Step 5 — Redact secrets safely and state what was redacted

  • Replace tokens and keys with placeholders while noting their type and expected shape.

Anti-Pattern (Before)

'Error occurred. Please fix.'

Problems: It lacks stack, context, and reproducer. The Agent cannot determine which part of the code triggered the failure.

Recommended Pattern (After)

'Error: TypeError: Cannot read property of undefined

at processOrder (src/services/order.js:128:24)

at runPipeline (src/pipeline/index.js:45:12)

at Object.<anonymous> (src/cli/run.js:10:5)

Environment: Node 18.12.1, Linux x86_64, memory 8GB

Dependencies: service-core@2.3.0, pricing@1.1.4

Request payload: { orderId: 12345, items: [ { id: 1, qty: 2 } ] }

Recent change: replaced pricing call with new bulk endpoint on 2025-10-02'

Benefits: The Agent can reproduce the failure, trace the stack to the exact file and line, and suggest targeted fixes.

Best Practices

  • Paste raw logs rather than screenshots when possible.
  • Include both the error and the lines immediately before and after the exception.
  • Note whether the error is deterministic or intermittent.
  • Attach the minimal reproduction snippet if available.

Agent Prompts

"Here is the full error log and environment metadata. Explain the root cause and propose a minimal fix."

"Run this reproduction snippet and show the stack trace and variable snapshots at the error line."

"Trace execution from the entry point to the error and list assumptions that are invalid."

Notes

  • Redact secrets but keep their shape and type information.
  • If logs are large, provide the most recent 200 lines plus the lines near the exception.
  • For intermittent issues, include timestamps and correlating request ids or trace ids.
View Tool Page