Explain Python unpacking errors

Paste a Python unpacking error, such as "too many values to unpack (expected 2, got 3)", and Vibe explains it in plain English: which line split a value into names, how many parts it got and where the extra one came from.

unpack-error.txt

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe8 lines selected

Press Explain it for the sample, or paste your own code first.

What this Python unpacking error sample shows

the message
ValueError: too many values to unpack (expected 2, got 3) means a line wanted to split one value into 2 names and the value had 3 parts. The ^^^^^^^^^^^ under name, price on line 9 shows which line: for name, price in reader: gives each CSV row to 2 names. The traceback starts at line 14, the call to load_prices, and the run ended with exit code 1 before anything printed.
where the extra value came from
Line 4 of prices.csv is Mug, large,12.50. The comma in the product name splits it into 3 fields, Mug, large and 12.50, so that row had 3 parts. The error doesn't say which row it was on; counting the fields in each line of the file finds it.
quoting the CSV
With the name in quotes, "Mug, large",12.50, the csv module kept it as one field, and the script printed 4 products: Notebook | Pen | Mug, large | Sticker and cheapest 0.80, with exit code 0. Quotes are how a CSV file keeps a comma inside a field.
not enough values
The same line fails the other way when a row is short. With the quoted file and an empty line added before Sticker,0.80, it stopped with ValueError: not enough values to unpack (expected 2, got 0): the csv module turned the empty line into a row with no fields.

Good to know

  • Run with Python 3.14.7 on Linux in a test folder mounted at /home/dev/shop. prices.csv has a header line, name,price, and 4 products.
  • Python 3.11.18 left the count out of the first message: ValueError: too many values to unpack (expected 2), with no got 3. The empty-line case read the same in both versions.

Before you trust it: Reshaping the unpack hides the bad row. for name, price, *rest in reader: moved the crash to the next line, ValueError: could not convert string to float: ' large', because large was now the price. Taking row[0] as the name and row[-1] as the price ran with exit code 0 and printed 4 products: Notebook | Pen | Mug | Sticker: the product was saved as Mug, and large was gone without a word. Fix the file's quoting, or check each row's field count and report the row.

Explain Python unpacking errors beside your editor

Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

No install warning? Use Unvibe in your browser

Opening the .dmg the first time

Unvibe isn't notarized by Apple yet, so macOS blocks the first open until you allow it. Its code is public on GitHub.

  1. Open the .dmg, drag Unvibe to Applications and open it. macOS says it can't verify it. Click Done, not the blue Move to Trash.
    macOS dialog: “Unvibe” Not Opened, with a blue Move to Trash button on top and Done under it
    Real screen, macOS 26. On macOS 15 the two buttons sit side by side.
  2. System Settings › Privacy & Security, scroll down to Security, then press Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15
  3. Unvibe opens. You only do this once, and later versions install from inside the app with one click.
    Unvibe's first window: Vibe says Hey! I'm Vibe. I explain the code AI writes for you, right beside your editor, over the title Understand the code AI writes
    Real screen, Unvibe 0.1.51 on macOS 26

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open