rohitg00/ai-engineering-from-scratch · error · ProtocolError
transport has no scripted response left
Error message
transport has no scripted response left
What it means
Error "transport has no scripted response left" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at certifications/claude/lessons/08-messages-api-and-application-lifecycle/code/main.py:67
delivery = "message-batch"
elif needs.progressive_output:
delivery = "streaming"
else:
delivery = "synchronous"
return {"client": client, "delivery": delivery}
class ScriptedTransport:
"""A stateless transport that returns scripted API responses."""
def __init__(self, responses: list[dict[str, Any]]) -> None:
self._responses = copy.deepcopy(responses)
self.requests: list[list[dict[str, Any]]] = []
def create(self, messages: list[dict[str, Any]]) -> dict[str, Any]:
self.requests.append(copy.deepcopy(messages))
if not self._responses:
raise ProtocolError("transport has no scripted response left")
return self._responses.pop(0)
class MessageLifecycle:
"""Own conversation state and advance it until the model ends the turn."""
def __init__(
self,
transport: ScriptedTransport,
tools: dict[str, Callable[[dict[str, Any]], Any]] | None = None,
max_turns: int = 8,
) -> None:
if max_turns < 1:
raise ValueError("max_turns must be positive")
self.transport = transport
self.tools = tools or {}
self.max_turns = max_turns
View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at certifications/claude/lessons/08-messages-api-and-application-lifecycle/code/main.py:67 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26).
Data as JSON: /api/errors/a7a0e2da20f36c46.
Report an issue: GitHub.