# Problem with Shopify CLI

**URL:** <https://community.shopify.com/t/problem-with-shopify-cli/109367>\
**Category:** Store Design\
**Created:** [March 25, 2022, 2:58pm UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367 "2022-03-25T14:58:07Z")\
**Posts on this page:** 8\
**Page:** 1

## AI-generated summary

Issue: Shopify CLI throws “An unexpected error occurred” when running `shopify theme serve` (and sometimes `shopify theme pull`) despite up-to-date installs (Shopify CLI 2.15.1, Ruby 3.3.7, Git 2.35.1). Screenshot/stacktrace prompt noted.

Key context: Shopify CLI manages theme development; `theme serve` runs a local dev server; `theme pull` fetches a store theme.

Reported fixes/workarounds:
- Session reset: Log out of Shopify in the browser and CLI (`shopify logout`), log into the store admin in the browser, then `shopify login --store {shop}.myshopify.com`. This enabled `theme serve` for some. OP succeeded after repeating steps with a different partner account.
- Explicit theme selection: After `shopify theme list`, run `shopify theme pull {theme-name}` and confirm selection when prompted. One user also changed runtimes (Ruby 3.0.0, Node >14); pull worked, but `theme serve` still had issues.
- Correct working directory: Error resolved when files were moved to the proper theme directory.

Other note: A user reported `shopify login` not found (CLI suggested `hydrogen login`), indicating possible CLI version/command differences.

Status: No single root cause. Multiple workarounds helped; some `theme serve` issues remain for certain setups.

<div class="post-metadata">

**Author:** ![ehsan1](https://avatars.discourse-cdn.com/v4/letter/e/7ea924/32.png) [@ehsan1](https://community.shopify.com/u/ehsan1)\
**Post date:** [March 25, 2022, 2:58pm UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/1 "2022-03-25T14:58:07Z")

</div>

I installed the latest versions of Ruby, Git, and Shopify CLI but when I use the command “Shopify theme serve” I got this error and also same for the command “Shopify theme pull”.

"X An unexpected error occurred.  
To submit an issue include the stack trace.

? Send an anonymized error report to Shopify? (Navigate up with ‘k’ and down with ‘j’, press Enter to select, filter with  
‘f’)

> 1. Yes, send

1. No, don’t send"

And I already added SHOPIFY\_CLI\_STACKTRACE=1 in the environmental variables.

I tried different solutions to solve this error but am not able to solve it so please kindly help me with this.

Screenshot of the error is also attached.

Shopify version: 2.15.1  
Ruby version: 3.3.7

Git version: 2.35.1

 ![Screenshot (477).png](https://canada1.discourse-cdn.com/shopifyforum/original/3X/1/9/190346a0c16f008b62a1e01f1c8c6dbb729d2069.png)

---

<div class="post-metadata">

**Author:** ![AlexWzorek](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@AlexWzorek](https://community.shopify.com/u/AlexWzorek)\
**Post date:** [March 25, 2022, 9:47pm UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/2 "2022-03-25T21:47:23Z")

</div>

I also followed the setup guide, however, Im getting the same error when I use “shopify theme serve”. I was able to pull but unable to run the server.

---

<div class="post-metadata">

**Author:** ![AlexWzorek](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@AlexWzorek](https://community.shopify.com/u/AlexWzorek)\
**Post date:** [March 25, 2022, 11:53pm UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/3 "2022-03-25T23:53:26Z")

</div>

Update:

Found a solution.

1. Log out of your shopify account in the browser
2. Log out through shopify CLI (if not already logged out) “shopify logout”
3. Log in to {shop}.myshopify.com/admin in the browser
4. Then log in through shopify CLI “shopify login --store {shop}.myshopify.com”

You should be able to run “shopify theme serve” after this. If not, make sure you log out of anywhere you’re logged in to shopify and try again.

---

<div class="post-metadata">

**Author:** ![ehsan1](https://avatars.discourse-cdn.com/v4/letter/e/7ea924/32.png) [@ehsan1](https://community.shopify.com/u/ehsan1)\
**Post date:** [March 26, 2022, 8:40am UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/4 "2022-03-26T08:40:48Z")

</div>

I followed all of your steps but the same error is still there 😞

---

<div class="post-metadata">

**Author:** ![ehsan1](https://avatars.discourse-cdn.com/v4/letter/e/7ea924/32.png) [@ehsan1](https://community.shopify.com/u/ehsan1)\
**Post date:** [March 26, 2022, 10:25am UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/5 "2022-03-26T10:25:16Z")

</div>

I tried your solution again with a different partner account and it worked for me.  
Thanks a lot! i almost wasted 2 days to solve this issue.  
Thanks again! really appreciate your help!

---

<div class="post-metadata">

**Author:** ![atila](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/atila/32/288305_2.png) [@atila](https://community.shopify.com/u/atila)\
**Post date:** [July 11, 2022, 2:36pm UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/6 "2022-07-11T14:36:52Z")

</div>

I stumbled on this issue today and spent hours and hours to track it down and get solved.

Initially, I downgraded my ruby version to 3.0.0 and upgraded node to above 14 version.

The problem persisted and I ran the command

```markup
shopify theme pull shopify-mystore

```

adding the theme name after the command just as it appears when I ran

```markup
shopify theme list

```

Finally it went through but not before displaying me the list of themes on my store and asking me to confirm by the number of it. This time the pull went through and I found myself in another problem on the

```markup
shopify theme serve

```

But that’s an issue for another chapter.

---

<div class="post-metadata">

**Author:** ![cgtysnsy](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cgtysnsy](https://community.shopify.com/u/cgtysnsy)\
**Post date:** [April 16, 2023, 8:34pm UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/7 "2023-04-16T20:34:30Z")

</div>

I also faced the same error, but I realized that I had placed my files in the wrong directory. Once I corrected the directory, the error was resolved.

---

<div class="post-metadata">

**Author:** ![JAO1](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@JAO1](https://community.shopify.com/u/JAO1)\
**Post date:** [September 5, 2024, 7:17am UTC](https://community.shopify.com/t/problem-with-shopify-cli/109367/8 "2024-09-05T07:17:35Z")

</div>

Command `login` not found. Did you mean `hydrogen login`?

looks they removed that
