codingintermediate

Bug Finder

Identifies bugs, edge cases, and potential runtime errors in a code snippet.

Prompt

Analyze this {{language}} code for bugs and potential runtime errors. For each issue found:

1. **Location**: line number or code region
2. **Bug type**: logic error, race condition, memory leak, type error, boundary issue, etc.
3. **Reproduction**: minimal input or sequence that triggers the bug
4. **Fix**: corrected code snippet

Focus on issues that would cause incorrect behavior or crashes in production, not style.

```{{language}}
{{code}}
```

Variables

{{language}}{{code}}

Example Output

**Bug 1** -- Location: line 23
Type: Off-by-one error
The loop condition `i <= arr.length` should be `i < arr.length`...

Use Cases

  • Debugging failing tests
  • Pre-deployment safety check
  • Code audit

Compatible Models

claude-sonnet-4-20250514gpt-4ogemini-2.5-pro

Tags

debuggingbugserror-detection

Details

Author
PromptIndex
Updated
2026-04-01
Difficulty
intermediate

Related Prompts

  • Code Review Assistant

    Performs a thorough code review covering correctness, performance, security, and maintainability.

  • Test Generator

    Generates comprehensive unit tests for a function or module with edge cases and mocks.

  • Refactoring Assistant

    Suggests and implements refactoring improvements while preserving behavior.