microsoft/autogen · error · ValueError

No more recorded turns to check.

Error message

No more recorded turns to check.

What it means

Raised in replay mode when the code under test makes more create() calls than were recorded: the replay index has consumed all records. It usually means the current conversation diverged from the recorded one and produced an extra LLM call.

Source

Thrown at python/packages/autogen-ext/src/autogen_ext/experimental/task_centric_memory/utils/chat_completion_client_recorder.py:118

                json_output=json_output,
                tool_choice=tool_choice,
                extra_create_args=extra_create_args,
                cancellation_token=cancellation_token,
            )

            rec: RecordDict = {
                "mode": "create",
                "messages": current_messages,
                "response": response.model_dump(),
                "stream": [],
            }
            self.records.append(rec)
            return response
        elif self.mode == "replay":
            if self._record_index >= len(self.records):
                error_str = "\nNo more recorded turns to check."
                self.logger.error(error_str)
                raise ValueError(error_str)
            rec = self.records[self._record_index]
            if rec.get("mode") != "create":
                error_str = f"\nRecorded call type mismatch at index {self._record_index}: expected 'create', got '{rec.get('mode')}'."
                self.logger.error(error_str)
                raise ValueError(error_str)
            recorded_messages = rec.get("messages")
            if recorded_messages != current_messages:
                error_str = (
                    "\nCurrent message list doesn't match the recorded message list. See the pagelogs for details."
                )
                assert recorded_messages is not None
                self.logger.log_dict_list(recorded_messages, "recorded message list")
                assert current_messages is not None
                self.logger.log_dict_list(current_messages, "current message list")
                self.logger.error(error_str)
                raise ValueError(error_str)
            self._record_index += 1
            self._num_checked_records += 1

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. If the code legitimately makes more calls now, re-record the session with mode='record' and use the new file.
  2. Check the pagelogs/logger output just before the failure to see which call diverged.
  3. Make the agent flow deterministic (fixed tool outputs, seeded decisions) so call counts match the recording.

Example fix

# before
client = ChatCompletionClientRecorder(inner, mode="replay", session_file_path="sessions/old.json")
# ValueError: No more recorded turns to check.

# after
# re-record once with the new flow, then replay:
client = ChatCompletionClientRecorder(inner, mode="record", session_file_path="sessions/new.json")
run_agent()  # then switch back to mode="replay"
Defensive patterns

Strategy: try-catch

Validate before calling

import json
from pathlib import Path

def session_covers(session_file: str, expected_calls: int) -> bool:
    records = json.loads(Path(session_file).read_text())
    return len(records) >= expected_calls

Try / catch

try:
    await run_under_replay(client)
except ValueError as e:
    if "No more recorded turns" in str(e):
        pytest.fail("Agent issued more LLM calls than recorded - re-record the session")
    raise

Prevention

When it happens

Trigger: Running with mode='replay' after the agent's logic changed to issue an additional LLM request per run (new tool loop iteration, extra agent turn), or replaying against a test flow with more create() calls than the session captured.

Common situations: Code changes adding retries or extra LLM calls after the session was recorded, non-deterministic agent loops (extra tool-call round), tests sharing one session file in different orders, sessions recorded with a different library version.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/0a453135608d1ae8. Report an issue: GitHub.