# X_AI_SCRIPT_EXHAUSTED

## Means

a scriptedProvider was called more times than it has turns

## Typical cause

the code under test asked the model for one more turn than scriptedProvider({ turns }) scripted: a loop that never calls respond, or a script one turn short. Never answered by repeating the last turn, so a runaway loop cannot read as a pass

## Fix

`scriptedProvider({ turns: [...turns, { answer: { /* the expected output */ } }] })   # one more turn, or fix the loop that keeps calling the model`

[MCP and AI](/error-codes#mcp-and-ai)
