Prompt pattern · Build

Debug buddy

The PyramidDescribe it clearly and small things become real.

The template

I'm getting this error:
{the exact error message}
Here's the code:
{the relevant code}
I expected {what should happen}, but {what happens instead}. I've already tried {what you tried}. Explain the likely cause in plain words, then show the fix.

Fill in the {blanks} with your own words, then send it.

Before and after

Before

My code doesn't work. Fix it.

After

I'm getting this error: TypeError: Cannot read properties of undefined (reading 'length') Here's the code: (the function, pasted) I expected it to count the items in the list, but it crashes when the list is empty. I've already checked the spelling. Explain the likely cause in plain words, then show the fix.

Works best for

Error messages, broken formulas, and scripts that worked fine yesterday.

Words worth knowing

Skills that pair with it

More in Build