Add message when store not found. #6681
Draft
+36
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
Addresses feedback from internal Slack discussion: https://shopify.slack.com/archives/C05E3BDFDRB/p1764604207635019
Also fixes community forum issue: https://community.shopify.dev/t/cli-cant-access-another-stores-account/26483
Problem: When users log out and log in with a different account, the CLI tries to use the cached store from the previous account. This results in confusing error messages that don't explain:
--storeto select a different storeshopify auth loginto switch back to the account with accessWHAT is this pull request doing?
Improves error messages in three locations where store access errors occur:
1. App Dev - Store Not Found in Organization
File:
packages/app/src/cli/services/dev/fetch.tsWhen a cached store doesn't exist in the current organization (lines 128-137).
Before:
After:
2. Theme/App Dev - Invalid Target Authentication Error
File:
packages/cli-kit/src/private/node/session/exchange.tsWhen token exchange fails with
invalid_target(lines 213-220).Before:
After: (Added two new suggestions at the top)
3. Theme Dev - 403 Admin API Access Error
File:
packages/cli-kit/src/public/node/api/admin.tsWhen accessing the Admin API returns 403 (lines 172-185). This is the exact error from the community forum post.
Before:
After:
Tests Added/Updated
fetch.test.ts: Existing test updated to match new error message ✅admin.test.ts: New test for 403 admin API error case ✅exchange.test.ts: Tests still pass ✅All 29 tests passing across modified files.
How to test your changes?
Scenario 1: App dev with wrong account
shopify auth logoutthenshopify auth loginwith account Bshopify app dev--storeandshopify auth loginScenario 2: Theme dev with wrong account
shopify theme devwith store from account Ashopify auth logoutthenshopify auth loginwith account Bshopify theme dev--storeandshopify auth loginScenario 3: Using --store flag
shopify app dev --store other-store.myshopify.comMeasuring impact
How do we know this change was effective? Please choose one:
Checklist