Copilot Said It Sorted All 20 Rows. I Counted 19.

I once asked an AI assistant to sort a list of 20 file numbers and flag the duplicates. It handed back a neat, confident answer. Then I counted the rows. Nineteen. One number had quietly left the building, and it wasn’t even one of the duplicates. When I pointed it out, the assistant apologised and put the row back, in the wrong spot. Classic.

That’s the story behind a recent r/PromptEngineering post, and it’s a small example worth stealing. I’ve since seen versions of it in other places: a contact list that lost a name, a to-do export that dropped the last item, a product feed where one SKU simply never made the trip. Different tools, same quiet shrug.

Why It Matters 🧭

The scary part isn’t the mistake. Everyone makes mistakes. The scary part is the confidence. The output looked tidy, so nobody would have checked. If that list had been invoices, customer IDs or inventory, a missing row could travel a long way before anyone noticed. Picture a payment run that skips one supplier, or a mailing list that never reaches one customer. Nobody gets an error message. Somebody just gets a very awkward email three weeks later.

AI tools are great at producing something that looks finished. They are less great at telling you when something fell off the back of the truck. Language models predict plausible text, and a plausible-looking list of 19 rows looks almost identical to a list of 20. So the fix is not to trust harder. It’s to make the gaps visible.

How-To Steps 🛠️

Here’s the simple habit the original poster landed on, plus one extra from the comments.

  1. Give your list as usual. Ask for the sort, the duplicate marking, whatever you need. Paste the data cleanly, one item per line, so the model isn’t guessing where one row ends and the next begins.
  2. End the prompt with a count check. Something like: “At the end, state the row count of the input and the row count of the output, side by side.”
  3. Compare the two numbers. If they match, carry on. If they don’t, you’ve caught the problem in five seconds instead of five days.
  4. Optional upgrade from the comments: Ask the model to first echo every input item with its line number, and only then do the sorting in a second step. That gives you a numbered reference to check against, and any missing number jumps out at you straight away.

Example prompt ending:

“Sort the list above and mark any numbers that appear more than once. When you’re done, give me: input rows = X, output rows = Y. If X and Y differ, tell me which items are missing before you do anything else.”

That last sentence is a nice bonus. It turns a silent failure into a loud one, which is exactly what you want.

Tips & Tricks ✨

  • Be honest about what this does. The original poster says it doesn’t stop the mistake. It just shows it right away. That’s still a big win.
  • Count it yourself too, at least at first. If the model reports matching numbers but your own count disagrees, you’ve learned the model’s counting can’t be trusted for that task. Do this a handful of times and you’ll know how much slack to give it.
  • Split big jobs into two steps. One step to restate the data with line numbers, one to transform it. Smaller steps leave fewer places to hide. A list of 200 rows is a much riskier ask than four lists of 50.
  • Don’t just say “you missed one” and accept the repair. In the story, the fixed row landed in the wrong place. Re-run the count check after any correction, and glance at where the returned row actually sits.
  • Ask for a checksum-style detail. A simple one: have the model report the first and last item of the output. If those look wrong for your sort order, something went sideways.
  • Use a different tool when exactness matters. For lists where every row counts, a spreadsheet sort or a tiny script will not quietly delete a row. Let the AI write the script, then let the script do the sorting.

Your Turn 🚀

Next time you hand an AI a list, add one line at the end asking for input and output row counts. It costs you ten seconds. Then tell me in the comments what it caught, or whether it passed with flying colors. I’d love to hear your own “I counted 19” story.

Frequently Asked Questions

Q: If I already check the row count, why does the model still drop lines?

The row count shows you that a mistake happened, but it does not stop the mistake from happening. Once the numbers don’t match, you know to re-run the task or check the output by hand. Treat the count as an alarm, not a fix.

Q: What prompt change helps more than counting rows?

Ask the model to echo every input item with its line number before it does anything else. With the numbered copy on screen, a missing line is easy to spot. Then make the sorting a second step that refers to line numbers instead of retyping the items.

Q: When should I skip the model and use a spreadsheet?

One reader’s rule of thumb is anything longer than about 30 rows. Sort and remove exact duplicates in a spreadsheet, where nothing gets silently lost. Save the model for the fuzzy work, like spotting near-duplicates that a formula would miss.

Copilot dropped one row from my test list and told me it had done them all
by u/Foxnicol5 in PromptEngineering

Scroll to Top