---
title: JSONMissingBlock
description: >-
  A validation that identifies instances where a JSON template file is
  referencing block types that don't exist.
source_url:
  html: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/json-missing-block
  md: >-
    https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/json-missing-block.md
---

# JSONMissingBlock

Ensures that a JSON template file includes block types that reference valid files and are declared at the root level of their associated schema.

***

## Examples

The following example contains code snippets that either fail or pass this check.

### ✗ Fail

In the following example, the JSON template file references a block type that doesn't exist. There's no corresponding `invalid-block.liquid` file in the `blocks` directory for the theme:

## templates/index.json

```json
{
  "sections": {
    "custom-section": {
      "type": "custom-section",
      "blocks": {
        "invalid-block": {
          "type": "invalid-block"
        }
      },
      "block_order": ["invalid-block"]
    }
  },
  "order": ["custom-section"]
}
```

### ✗ Fail

In the following example, the JSON template file references a block type that exists, but is not declared at the root level of the `custom-section` liquid section schema:

## templates/index.json

```json
{
  "sections": {
    "custom-section": {
      "type": "custom-section",
      "blocks": {
        "text-block": {
          "type": "text"
        }
      },
      "block_order": ["text-block"]
    }
  },
  "order": ["custom-section"]
}
```

## sections/custom-section.liquid

```liquid
{% schema %}
{
  "name": "Custom Section",
  "blocks": [
    {
      "type": "image"
    }
  ]
}
{% endschema %}
```

### ✗ Fail

In the following example, the JSON template file references a block type that exists, but isn't declared at the root level of the `text` liquid block schema:

## templates/index.json

```json
{
  "sections": {
    "custom-section": {
      "type": "custom-section",
      "blocks": {
        "parent_block": {
          "type": "text",
          "blocks": {
            "child_block": {
              "type": "missing_nested"
            }
          }
        }
      },
      "block_order": ["parent_block"]
    }
  },
  "order": ["custom-section"]
}
```

## blocks/text.liquid

```liquid
{% schema %}
{
  "name": "Text",
  "blocks": [
    {
      "type": "image"
    }
  ]
}
{% endschema %}
```

### ✓ Pass

In the following example, the JSON template file references a block type that exists, and is declared at the root level of the `custom-section` liquid section schema:

## templates/index.json

```json
{
  "sections": {
    "custom-section": {
      "type": "custom-section",
      "blocks": {
        "text-block": {
          "type": "text"
        }
      },
      "block_order": ["text-block"]
    }
  },
  "order": ["custom-section"]
}
```

## sections/custom-section.liquid

```liquid
{% schema %}
{
  "name": "Custom Section",
  "blocks": [
    {
      "type": "text"
    }
  ]
}
{% endschema %}
```

### ✓ Pass

In the following example, the JSON template file references a block type that exists, and is declared at the root level of the `text` liquid block schema:

## templates/index.json

```json
{
  "sections": {
    "custom-section": {
      "type": "custom-section",
      "blocks": {
        "parent_block": {
          "type": "text",
          "blocks": {
            "child_block": {
              "type": "image"
            }
          }
        }
      },
      "block_order": ["parent_block"]
    }
  },
  "order": ["custom-section"]
}
```

## blocks/text.liquid

```liquid
{% schema %}
{
  "name": "Text",
  "blocks": [
    {
      "type": "image"
    }
  ]
}
{% endschema %}
```

***

## Options

The following example contains the default configuration for this check:

```yaml
JSONMissingBlock:
enabled: true
severity: error
```

| Parameter | Description |
| - | - |
| `enabled` | Whether this check is enabled. |
| `severity` | The [severity](https://shopify.dev/docs/storefronts/themes/tools/theme-check/configuration#check-severity) of the check. |

***

## Disabling this check

Disabling this check isn't recommended.

***
