Shopify CLI was working earlier this morning, then I tried to push, publish and even rename my dev theme for my dev store and kept getting a 401 error.
Turns out even shopify theme dev is no longer working, which it was just 10 mins prior.
I feel like this is something upstream but I don’t have any contacts to confirm.
Running with --verbose flag just shows the request failing at the same time, with some comments about the info being sent to BugSnag, if that’s any use?
Just ran into the same situation where pull/dev worked one minute and then didn’t a bit later. The comment above mine made me realize I had cycled having 2FA enabled on my account in the interim, which likely resulted in auth tokens getting rescinded so a simple re-login in the CLI solved the issue.
Thanks for all the responses. Unfortunately I was also unable to run the command shopify login as the CLI was saying that command didn’t exist. I suspect it was some sort of auth token issue, but I’m not familiar with how things work under the hood, so I was really left to just try “turning it off and on again”
That seemed to have worked, so I’m not too sure what this was.
This may be one of those “intermitent hard to diagnose and replicate” issues, which are always so much fun.
At least now there’s a thread with the error message that may shed some light for future users.
There is no shopify login command, it’s shopify auth, and it was definitely related to your auth token issue. This usually happens if you haven’t used the CLI for weeks or if you’ve updated auth-related account info like enabling 2FA or changing your password.
I believe I am a victim of another AI hallucination then, as the steps recommended to me two different times suggested to run shopify login.
I will attach the screenshots.
I imagine there may be some outdated docs somewhere that suggests that or something, otherwise you can copy the big players with their top-notch prompts “Do not hallucinate, do not make up answers that aren’t real”
One other note, that may help in replicating/solving this: The steps that I believe caused my issue were
Create an account on the live store
Be granted limited (not Admin) permission
Use shopify theme dev --store companylivestore - this did not work, possibly a bug? Support staff just said “You’re supposed to use the web editor” (support ticket here)[https://help.shopify.com/en/inbox/10131117]
Setup a new store on same account (not a dev store, but a free trial store)
Use shopify theme dev --store mytrialstore - this worked to do theme dev
Use shopify theme dev --store partnerdevstore - this worked to do theme dev for about 30 mins
Wait maybe 30 mins or so
Then the 401 error occurred.
So maybe it’s just an edge case of an already authenticated token or something under the hood that then gets associated with a partner account. I can’t imagine it’s a super common flow, but it impacted me, nonetheless.
Hope this extra information may help in fixing the issue upstream (though it isn’t super simple to replicate and therefore diagnose)
I originally thought this was the answer and because the issue wasn’t occurring I didn’t feel I needed to validate it… However, I am getting an issue so I thought “YES! Now I can give this a go” only to find shopify auth also doesn’t have any login method.
$ shopify auth
Auth operations.
USAGE
$ shopify auth COMMAND
COMMANDS
auth logout Logs you out of the Shopify account or Partner account and store.
I don’t understand how that answer could be correct…
Use the shopify auth logout command to log out, then run shopify theme dev or any other command to prompt re-login.
I could be wrong about saying that it definitely was auth token issue, but if logging out and logging back in fixes it, there’s a good chance the token was the issue.