Improve missing theme scope error message#7652
Open
charlespwd wants to merge 1 commit into
Open
Conversation
010ba78 to
fc8c6f2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves theme API error handling by converting missing theme access scope GraphQL failures into actionable CLI abort errors.
Changes:
- Detects
ACCESS_DENIEDGraphQL errors withrequiredAccessinfetchThemes. - Replaces the raw GraphQL client error with a friendlier
AbortErrorand next-step guidance. - Adds test coverage and a patch changeset for the user-facing fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/cli-kit/src/public/node/themes/api.ts |
Adds missing theme scope detection and friendly error generation. |
packages/cli-kit/src/public/node/themes/api.test.ts |
Covers the new friendly error path for missing read_themes. |
.changeset/friendly-theme-scope-error.md |
Records the patch release note for @shopify/cli-kit. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fc8c6f2 to
41b800b
Compare
graygilmore
reviewed
May 29, 2026
Contributor
graygilmore
left a comment
There was a problem hiding this comment.
Love this! Couple of small things.
Contributor
There was a problem hiding this comment.
There are quite a few conditionals in this new logic that aren't covered by the test. We don't need to add all (e.g. don't add a test asserting that the message doesn't appear for other exceptions) but some extra coverage would be good.
41b800b to
5bada5e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
No public issue.
When theme commands use an account or token that cannot access Online Store themes, the Admin GraphQL API returns an
ACCESS_DENIEDerror for thethemesfield. The CLI currently surfaces the raw GraphQLClientErrorpayload, which makes the actionable fix hard to find.The high-volume observed case is a user-supplied theme password/token path, not a CLI-generated token path. Theme commands accept this value through
--password,SHOPIFY_CLI_THEME_TOKEN, or apasswordentry inshopify.theme.toml. If that value is a custom app Admin API access token, the custom app owner/admin controls its scopes in Shopify Admin. When the custom app is missingread_themes, Shopify correctly denies thethemesfield.If no password/token is supplied, the CLI uses the normal Shopify account OAuth flow and requests theme access. In that path, this error generally means the authenticated staff or collaborator account cannot access Online Store themes, so the fix is account permission/reauth rather than a missing custom app scope.
So the underlying failure is usually user/admin configuration. The CLI bug is that we present it like an unexpected GraphQL failure instead of an expected, actionable permission error.
WHAT is this pull request doing?
fetchThemesnow detects Admin GraphQLACCESS_DENIEDerrors that include a required access scope and rethrows them as a friendlyAbortError.Before, users saw a raw response/request JSON blob like:
After, users see a direct explanation and next step:
How to test your changes?
pnpm --filter @shopify/cli-kit vitest run src/public/node/themes/api.test.tsPost-release steps
No post-release steps.
Checklist
patchfor bug fixes ·minorfor new features ·majorfor breaking changes) and added a changeset withpnpm changeset addFixes shop/issues#32995