Why do I see MAX_HEIGHT_LIMIT, MAX_DEPTH_LIMIT, and MAX_ALIASES_LIMIT errors?
These errors indicate that your GraphQL operation exceeds system limits for height, depth, or alias count.
Our GraphQL API enforces limits to maintain performance and security. The three common limits are:
- MAX_HEIGHT_LIMIT: Triggered when the total number of fields, including nested selections, exceeds the maximum allowed (130 fields).
- MAX_DEPTH_LIMIT: Triggered when the nesting level of fields in a query exceeds the maximum allowed depth (15 levels).
- MAX_ALIASES_LIMIT: Triggered when the number of aliases in an operation exceeds the allowed threshold (5 aliases).
If you encounter these errors, start with a minimal query and expand gradually.
Reduce overall height (field selections)
- Request only the fields you need.
- Paginate lists. Apply smaller values for top-level and nested lists.
Reduce depth (nesting level)
- Avoid deeply nested queries.
- Use fragments to simplify repeated structures.
- Split large queries into smaller, focused ones.
Reduce aliases
- Remove unnecessary aliases.
- Use aliases only when you need multiple differently labelled instances of the same field.
Practical pattern
Operation
This pattern:
- Fetches only essential fields.
- Uses pagination with variables for flexibility.
- Avoids excessive aliasing.
GraphQL Query
Variables
Understanding the limits in this example
MAX_HEIGHT_LIMIT
- Maximum 130 fields
- This query uses 15 fields:
- assetSearch (Field 1) The Root Field is always counted as the first selection.
- Inside assetSearch:
- nodes (Field 2) Each field in the path is counted because it represents a distinct resolution step.
- id (Field 3)
- name (Field 4)
- customer (Field 5) Object fields are counted because the server must resolve a nested type.
- id (Field 6) Scalar fields are counted as the final unique leaf in a specific path.
- name (Field 7)
- operatingSystemInfo (Field 8)
- name (Field 9)
- architecture (Field 10)
- type (Field 11)
- totalCount (Field 12)
- pageInfo (Field 13)
- endCursor (Field 14)
- hasNextPage (Field 15)
- nodes (Field 2) Each field in the path is counted because it represents a distinct resolution step.
MAX_DEPTH_LIMIT
- Maximum 15 levels
- This query uses 3 levels:
- assetSearch (Level 1)
- nodes (Level 2)
- customer (Level 3)
- operatingSystemInfo (Level 3)
MAX_ALIASES_LIMIT
- Maximum 5 aliases
- This query uses 1 alias:
- deviceNodes
When you need more details, add fields incrementally and re-run the query, watching height and alias counts.
Updated about 15 hours ago