AIO APEX
GPT-4Debugging

Assistant de débogage systématique

Partager:

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 ?? []; ```

Assistant de débogage systématique

Une approche étape par étape pour trouver et résoudre efficacement les bugs.

Ce prompt d'IA est conçu pour vous aider à obtenir les meilleurs résultats. Suivez les instructions et personnalisez les paramètres selon vos besoins spécifiques.

Pour obtenir les meilleurs résultats, fournissez un contexte détaillé et spécifiez le format de sortie souhaité. Expérimentez avec différentes variations pour trouver celle qui convient le mieux à votre cas d'utilisation.

Partager:
Assistant de débogage systématique | AIO APEX