Resolving the 'invalid_target' error in Shopify CLI: Any solutions?

I am just learning how the Shopify CLI works and am just following the docs right now. Whenever I run shopify theme dev --store {my-store}, I am able to log in successfully but then get an error saying invalid_target.

I can’t find any info on this error in the documentation, and have tried the login process on both Firefox and Chrome browsers. Has anyone been able to resolve this issue successfully?

5 Likes

HI @bcrave , Can you please share a screenshot or something so that I can take a better look at the issue.

1 Like

I’ve had the same problem since yesterday.

I upgraded the Shopify CLI version from 3.22.1 to 3.23.0 and downgraded to the stable Node version, but it still did not work.

![Screenshot 2022-11-18 at 14.49.27.png|1256x538](upload://e7ynD4a228EpVO4altpmjYKJjIk.png)

https://www.youtube.com/watch?v=YM0XOa2LZSs

Maybe this video can help you in any way

Thanks for the video but the error is occurring after this screen:

1 Like

Yep. I’m noticing the same problem…I have particularly noticed that people who are using the

shopify theme pull --store {your-store-name.myshopify.com}.

I finally got it to work. I was using the store name instead of store URL. This is what worked for me:

shopify theme dev --store=https://my_store.myshopify.com

5 Likes

The docs are confusing if you’re a designer and the --store flag seems to be written different ways depending on the page with respect to the store URL. Shopify needs to do better at catering to us lowly designers!

Show More

To fix, remove the {} from the command like this…

shopify theme pull --store https://yourstore.myshopify.com

NOT this (as written in some of the docs)…

shopify theme pull --store {yourstore.myshopify.com}
2 Likes

I tried it, but it didn’t work, I still get invalid_target. I would appreciate any help!

1 Like

Is there any update on this thread? I’ve been trying to fix this all morning but not had any luck yet. Still getting an ‘invalid_target’ error when trying to develop my theme

please use this link
https://community.shopify.com/c/technical-q-a/shopify-cli-returns-invalid-target-when-logging-in/td-p/1856533

I think you should to create a store on your account first.

  1. Go https://www.shopify.com/blog/start-online-store

  2. Click to “Start free trial” button then follow the guide

  3. Back to terminal and re-try the command

After spending hours to find the solution here is what you would need to type in the terminal to login and serve the theme. You will have to login first to your theme and know the store name. In below image I have pointed to the URL for the store name. You will get this URL after logging into the store.

Then run the following in the console:

shopify theme dev --store b5d80a-2

Note: Change b5d80a-2 to your own store name

Thank you

12 Likes

Yep, this worked for me.

1 Like

Thank you soooooo much!

This was driving me crazy, the store had been renamed so it was the original name that I needed all along to pull the theme file — before this, I was stumbling down many rabbit holes, so Kudos to you :blush:

1 Like

Thank you man !!

1 Like

useful , i’ve solved this problem, Thankyou

1 Like

It save my life. This issue took me an hour

1 Like

Thank you, this worked for me as well. First time this has happened to me, I guess it occurs when the store changes its name or something like that. Anyway, it’s all sorted now. Thanks again!