# Understanding and Fixing INVALID_ROUTING_MODEL in WhatsApp Flow JSON
Author: Prashant Jangid
Author URL: https://www.heltar.com/blogs/author/prashant-jangid
Published: 2025-04-07
Category: Troubleshoot
Category URL: https://www.heltar.com/blogs/category/troubleshoot
Tags: WhatsApp Flows Error
Tag URLs: WhatsApp Flows Error (https://www.heltar.com/blogs/tag/whatsapp-flows-error)
URL: https://www.heltar.com/blogs/understanding-and-fixing-invalidroutingmodel-in-whatsapp-flow-json-cm9766k0j000h10voz2dm50la

When working with WhatsApp Flows, you might run into the following error:

**INVALID\_ROUTING\_MODEL**

**Following screens are missing in the routing model: (screenIDs).**

This is a structural issue with your flow JSON. Let's break it down.

## What Triggers INVALID\_ROUTING\_MODEL

This error occurs when one or more screen.ids defined in the screens array are not referenced anywhere in the routing\_model. The WhatsApp API expects that every screen must be part of the routing logic — if a screen is unreachable, it’s considered invalid.

## WhatsApp Flow JSON Structure Overview

A flow JSON has two key sections:

### 1\. screens

An array of all screens used in the flow — each must have a unique id.

```
"screens": [
  {
    "id": "FIRST_SCREEN",
    "type": "FORM",
    ...
  }
]
```

### 2\. routing\_model

A mapping of screen transitions. It defines:

- The start screen

- Where each screen routes next, based on conditions or button selections


```
"routing_model": {
  "FIRST_SCREEN": [
    {
      "conditions": [...],
      "target": "NEXT_SCREEN"
    }
  ],
  "NEXT_SCREEN": []
}
```

## Invalid Example

```
{
  "routing_model": {
    "ABC": []
  },
  "screens": [
    {
      "id": "FIRST_SCREEN",
      "type": "FORM"
    }
  ]
}​
```

- FIRST\_SCREEN is defined in screens.

- But routing\_model only includes ABC.

- Result: FIRST\_SCREEN is considered unreachable → error thrown.

```
 {
    "routing_model": {
    "FIRST_SCREEN": []
  },
  "screens": [
    {
      "id": "FIRST_SCREEN",
      "type": "FORM"
    }
  ]
}
```

- Now FIRST\_SCREEN is part of the routing model.

- WhatsApp knows the flow starts or passes through this screen → error resolved.

## Fixing the Error: Step-by-Step

### 1\. Identify Missing Screens

Read the error:

INVALID\_ROUTING\_MODEL: Following screens are missing in the routing model: FIRST\_SCREEN, END\_SCREEN

### 2\. Check for Typos

Ensure the screen ids in routing\_model match exactly with the ones in screens.

### 3\. Add Missing Screens to Routing

Include them in the routing\_model like so:

```
"routing_model": {
  "FIRST_SCREEN": [
    {
      "target": "END_SCREEN"
    }
  ],
  "END_SCREEN": []
}
```

### 4\. Optional: Remove Unused Screens

If any screen isn't meant to be used, remove it from the screens array to avoid unnecessary validation errors.

For more troubleshooting insights related to WhatsApp Business API, check out [heltar.com/blogs](http://heltar.com/blogs).


---
This blog is powered by Superblog. Visit https://superblog.ai to know more.
---

