AIO APEX
GPT-4Debugging

Systematischer Debugging-Assistent

Teilen:

Why this prompt matters

Systematic debugging is faster than guessing. This prompt mirrors how senior engineers approach problems: parse, hypothesize, verify, fix.

What we use it for

Debugging

Prompt

I'm encountering this error. Help me debug it systematically: 1) Parse the error message and identify the root cause, 2) List the top 3 most likely causes in order of probability, 3) For each cause, provide a diagnostic command or code snippet to verify, 4) Once identified, provide the fix and explain how to verify it worked.

Result

## Error Analysis: `TypeError: Cannot read properties of undefined (reading 'map')`

**Root Cause**: The `users` variable is `undefined` when `.map()` is called, meaning the API response didn't match the expected shape.

**Most Likely Causes:** 1. (70%) API returned `{ data: { users: [...] } }` but code expects `{ users: [...] }` 2. (20%) API call failed silently and returned undefined 3. (10%) Race condition: component renders before data loads

**Fix**: Add optional chaining and validate response shape: ```js const users = response?.data?.users ?? []; ```

Systematischer Debugging-Assistent

Ein schrittweiser Ansatz zum effizienten Finden und Beheben von Bugs.

Dieser KI-Prompt ist darauf ausgelegt, Ihnen die besten Ergebnisse zu liefern. Folgen Sie den Anweisungen und passen Sie die Parameter an Ihre spezifischen Bedürfnisse an.

Für die besten Ergebnisse geben Sie detaillierten Kontext an und spezifizieren Sie das gewünschte Ausgabeformat. Experimentieren Sie mit verschiedenen Variationen, um die beste für Ihren Anwendungsfall zu finden.

Teilen: