Shopify / Shopify/theme-tools

JSONMissingBlock false positive for app block when section supports both @app and @theme

Open Beginner friendly
#1,144 2 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

https://github.com/Shopify/theme-tools/blob/5612587be7af61fdc9c94b1ee621f1b89cf6f9ba/packages/theme-check-common/src/checks/json-missing-block/missing-block-utils.ts#L31

Describe the bug
When a section schema allows both @app and @theme blocks, Theme Check reports JSONMissingBlock for valid app block types in product.json.
It tries to resolve the app block URI as a local theme block file (... .liquid), which is incorrect.

Source
When having blocks defined in section defined like below

blocks: [{ type: '@app' }, { type: '@theme' }],

allows us to add two different types of blocks. This can result in structure like below in product.json

"main": {
      "type": "main-product",
      "blocks": {
        "some_app_block": {
          "type": "shopify://apps/some_app_block/....",
        }
      },

which will generate a false error

[error]: JSONMissingBlock
Theme block 'blocks/shopify://apps/some_app_block/.....liquid' does not exist.

Expected behaviour
App block URIs (shopify://apps/...) should be treated as valid when section schema includes @app, even if same section also includes @theme.

Actual behaviour
Theme Check raises JSONMissingBlock and treats the app block URI as a missing local theme block file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/theme-check-common/src/checks/json-missing-block/missing-block-utils.ts at line 31 and trace how block URIs are resolved when a section supports both @app and @theme. Verify that shopify://apps/... URIs are accepted as app blocks while missing local theme block files still report errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.