cli: [Bug]: Error on `shopify theme dev`

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

The command shopify theme dev should work.

Actual behavior

I have a problem after upgrading from 3.37.0 to 3.40.3 When I run shopify theme dev, I have the following error : (the other commands work properly)

╭─ error ──────────────────────────────────────────────────────────────────────────────╮
│                                                                                      │
│  [422] API request client error                                                      │
│                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────╯

Downgrade to 3.37.0 solves the problem for now.

Below is the same command with the --verbose flag :

2023-02-08T11:06:11.859Z: Running command theme dev
  shopify:theme:dev init version: @oclif/core@1.21.0 argv: [ '--theme=131972661399', '--verbose' ] +0ms
2023-02-08T11:06:11.877Z: Ensuring that the user is authenticated with the Theme API with the following scopes:
[]

2023-02-08T11:06:11.877Z: Ensuring that the user is authenticated with the Admin API with the following scopes for the store unique-starter-theme.myshopify.com:
[]

2023-02-08T11:06:11.913Z: Secure store is available
2023-02-08T11:06:11.913Z: Reading session from the secure store...
2023-02-08T11:06:11.919Z: Validating existing session against the scopes:
[
  "openid",
  "https://api.shopify.com/auth/shop.admin.graphql",
  "https://api.shopify.com/auth/shop.admin.themes",
  "https://api.shopify.com/auth/partners.collaborator-relationships.readonly",
  "https://api.shopify.com/auth/shop.storefront-renderer.devtools",
  "https://api.shopify.com/auth/partners.app.cli.access"
]
For applications:
{
  "adminApi": {
    "scopes": [],
    "storeFqdn": "unique-starter-theme.myshopify.com"
  }
}

2023-02-08T11:06:11.919Z: 
Sending GET request to URL https://accounts.shopify.com/.well-known/openid-configuration.json and headers:
 - User-Agent: Shopify CLI; v=3.40.3
 - Sec-CH-UA-PLATFORM: darwin
 - X-Request-Id: fb85bc3c-a5e3-49d2-9b9b-7ae681010eda
 - Content-Type: application/json

2023-02-08T11:06:12.216Z: Request to https://accounts.shopify.com/.well-known/openid-configuration.json completed with status 200 in 297 ms
2023-02-08T11:06:12.226Z: Sending Identity Introspection request to URL: https://accounts.shopify.com/oauth/introspection
2023-02-08T11:06:12.226Z: 
Sending POST request to URL https://accounts.shopify.com/oauth/introspection and headers:
 - User-Agent: Shopify CLI; v=3.40.3
 - Sec-CH-UA-PLATFORM: darwin
 - X-Request-Id: dab78a59-3300-41fa-8f21-074661d961ac
 - Content-Type: application/json

2023-02-08T11:06:12.450Z: Request to https://accounts.shopify.com/oauth/introspection completed with status 200 in 224 ms
2023-02-08T11:06:12.453Z: The identity token is valid: true
2023-02-08T11:06:12.454Z: 
The validation of the token for application/identity completed with the following results:
- It's expired: false
- It's invalid in identity: false
  
2023-02-08T11:06:12.454Z: The current session is valid but needs refresh. Refreshing...
2023-02-08T11:06:12.456Z: 
Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_a6b852e30a944c6e5657791b1a6c937c68095d3b9550aeb84c5957f319b58ad6&refresh_token=atkn_69e5935bd1dd987fd04bee2d27413a7c1e5b4221fe749c9d0d522b5ed78fb22e&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 and headers:
 - User-Agent: Shopify CLI; v=3.40.3
 - Sec-CH-UA-PLATFORM: darwin
 - X-Request-Id: 340c632b-a907-4398-be31-1708736228c0
 - Content-Type: application/json

2023-02-08T11:06:12.838Z: Request to https://accounts.shopify.com/oauth/token?grant_type=refresh_token&access_token=atkn_a6b852e30a944c6e5657791b1a6c937c68095d3b9550aeb84c5957f319b58ad6&refresh_token=atkn_69e5935bd1dd987fd04bee2d27413a7c1e5b4221fe749c9d0d522b5ed78fb22e&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3 completed with status 200 in 382 ms
2023-02-08T11:06:12.844Z: 
Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=atkn_78ac64ce4396ff52e42e67f334ffb26c9400a864de5cb44c30b78cc648a902e3 and headers:
 - User-Agent: Shopify CLI; v=3.40.3
 - Sec-CH-UA-PLATFORM: darwin
 - X-Request-Id: 3d5ec98c-e058-41ad-aba5-8ea52d6970ef
 - Content-Type: application/json

2023-02-08T11:06:12.844Z: 
Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=atkn_78ac64ce4396ff52e42e67f334ffb26c9400a864de5cb44c30b78cc648a902e3 and headers:
 - User-Agent: Shopify CLI; v=3.40.3
 - Sec-CH-UA-PLATFORM: darwin
 - X-Request-Id: 9e905edf-7950-42f4-93ff-254b4c5916ba
 - Content-Type: application/json

2023-02-08T11:06:13.118Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=271e16d403dfa18082ffb3d197bd2b5f4479c3fc32736d69296829cbb28d41a6&scope=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.app.cli.access&subject_token=atkn_78ac64ce4396ff52e42e67f334ffb26c9400a864de5cb44c30b78cc648a902e3 completed with status 200 in 274 ms
2023-02-08T11:06:15.134Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=ee139b3d-5861-4d45-b387-1bc3ada7811c&scope=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.storefront-renderer.devtools&subject_token=atkn_78ac64ce4396ff52e42e67f334ffb26c9400a864de5cb44c30b78cc648a902e3 completed with status 200 in 2290 ms
2023-02-08T11:06:15.138Z: 
Sending POST request to URL https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&scope=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.graphql+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.themes+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly&subject_token=atkn_78ac64ce4396ff52e42e67f334ffb26c9400a864de5cb44c30b78cc648a902e3&destination=https%3A%2F%2Funique-starter-theme.myshopify.com%2Fadmin and headers:
 - User-Agent: Shopify CLI; v=3.40.3
 - Sec-CH-UA-PLATFORM: darwin
 - X-Request-Id: 2ef81788-cf87-458f-827f-3ce8e6de07e7
 - Content-Type: application/json

2023-02-08T11:06:15.504Z: Request to https://accounts.shopify.com/oauth/token?grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange&requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&subject_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aaccess_token&client_id=fbdb2649-e327-4907-8f67-908d24cfd7e3&audience=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c&scope=openid+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.graphql+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fshop.admin.themes+https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly&subject_token=atkn_78ac64ce4396ff52e42e67f334ffb26c9400a864de5cb44c30b78cc648a902e3&destination=https%3A%2F%2Funique-starter-theme.myshopify.com%2Fadmin completed with status 200 in 366 ms
2023-02-08T11:06:15.516Z: Secure store is available
2023-02-08T11:06:15.516Z: Updating session in the secure store with new content...
2023-02-08T11:06:15.548Z: Getting development theme...
╭─ error ──────────────────────────────────────────────────────────────────────────────╮
│                                                                                      │
│  [422] API request client error                                                      │
│                                                                                      │
╰──────────────────────────────────────────────────────────────────────────────────────╯

2023-02-08T11:06:16.313Z: Unable to log analytics event - no information on executed command

Stack trace

No response

Reproduction steps

Operating System

Mac OS Monterey (12.6.2)

Shopify CLI version (check your project’s package.json if you’re not sure)

3.40.3

Shell

zsh

Node version (run node -v if you’re not sure)

14.21.1

What language and version are you using in your application?

Ruby 3.1.2

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

@MatthewRCrigger I got the same error, but I was running npm run dev.

As @iamdeaneyelid suggests, running

npm run shopify auth logout
npm run dev

solves the issue for me.

Getting the same error. Weirdly enough it was working 2 hours ago…

@Shine18 I logged out (Shopify auth logout) and logged back in again and it seems to work now