PatchVault › Errors › Shopify CLI 5 migration

jq: error (at <stdin>:0): Cannot index object with number

After upgrading to Shopify CLI 5.0, `shopify theme list --json | jq '.[0]'` fails because the output is no longer a root array.

Check your code free (runs in your browser)

The box is pre-filled with a sample that triggers this error. Paste your own file to check it. Nothing leaves this page.

Or scan your whole repo locally (free, stdlib Python, read-only):

python3 <(curl -fsSL https://patchvault-81y.pages.dev/starters/shopify-cli-scan.py) .
Get the Shopify CLI 5 migration auto-fixer: $9 one-time

Why it happens

CLI 5.0 changes the theme list contract to {"themes": [...]}, and theme IDs become strings. An empty library returns {"themes": []}.

Manual fix

# before (4.x): root array, numeric ids
shopify theme list --json | jq '.[0].id'
# after (5.0)
shopify theme list --json | jq -r '.themes[0].id'      # "123" (string)

Verify

Re-run your install/build and re-scan the file above. The finding should be gone. The paid fixer applies the same change across a repo: --dry-run shows the diff, --apply keeps a .bak of each file, and --rollback restores them.

Sources

Related errors

Full guide and free terminal scanner: Shopify CLI 5 migration. Last checked 2026-10-31.