From 6ca29a973324c2e4e60003dab3e9008f55f2f73d Mon Sep 17 00:00:00 2001 From: Mike Taylor <4951910+sealocal@users.noreply.github.com> Date: Fri, 10 Apr 2026 07:55:11 -0700 Subject: [PATCH] report friendly error when cli fails to find shops to display --- packages/cli/src/lib/auth.test.ts | 10 ++++++++++ packages/cli/src/lib/auth.ts | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/packages/cli/src/lib/auth.test.ts b/packages/cli/src/lib/auth.test.ts index c824de0dfd..5c79661ace 100644 --- a/packages/cli/src/lib/auth.test.ts +++ b/packages/cli/src/lib/auth.test.ts @@ -128,6 +128,16 @@ describe('auth', () => { expect(result).toStrictEqual(EXPECTED_LOGIN_RESULT); }); + it('throws an error when account has no active shops', async () => { + vi.mocked(getUserAccount).mockResolvedValue({ + email: EMAIL, + activeShops: [], + }); + + await expect(login(ROOT)).rejects.toThrow(AbortError); + expect(renderSelectPrompt).not.toHaveBeenCalled(); + }); + it('prompts for shop is not found in arguments and local config', async () => { const result = await login(ROOT); diff --git a/packages/cli/src/lib/auth.ts b/packages/cli/src/lib/auth.ts index b60fea9118..4c3c86fe7a 100644 --- a/packages/cli/src/lib/auth.ts +++ b/packages/cli/src/lib/auth.ts @@ -67,6 +67,13 @@ export async function login(root?: string, shop?: string | true) { shop && userAccount.activeShops.find(({fqdn}) => shop === fqdn); + if (!preselected && userAccount.activeShops.length === 0) { + throw new AbortError( + 'No shops found for your Shopify account.', + "If you're just getting started, create a free dev store in your Shopify Dev Dashboard, then run the command again.", + ); + } + const selected = preselected || (await renderSelectPrompt({