microsoft/autogen · error · ValueError

Current message list doesn't match the recorded message list

Error message

Current message list doesn't match the recorded message list. See the pagelogs for details.

What it means

Thrown by ChatCompletionClientRecorder in 'replay' mode when the message list sent to create() differs from the one captured in the recorded session file. The recorder is a test/replay harness that verifies deterministic agent behavior; any divergence between the live message flow and the recording aborts with this ValueError. Both lists are dumped to the pagelogs so you can diff them.

Source

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

                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

            data = rec.get("response")
            # Populate a CreateResult from the data.
            assert data is not None
            result = CreateResult(
                content=data.get("content", ""),
                finish_reason=data.get("finish_reason", "stop"),
                usage=data.get("usage", RequestUsage(prompt_tokens=0, completion_tokens=0)),
                cached=True,
            )
            return result

        else:
            error_str = f"\nUnknown mode: {self.mode}"
            self.logger.error(error_str)
            raise ValueError(error_str)

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Open the pagelogs and diff the 'recorded message list' against the 'current message list' to find the first divergent message.
  2. If the divergence is an intended code/prompt change, re-record the session in 'record' mode to produce a fresh session file.
  3. Pin non-determinism: set temperature=0, seed if supported, and strip timestamps/UUIDs from message content before replaying.
  4. Ensure the exact same agent pipeline (tools, memory hooks, middleware) is active during replay as during recording.

Example fix

// before
client = ChatCompletionClientRecorder(base_client, mode="replay", session_file_path="session.json")
// after: re-record after any prompt/code change
client = ChatCompletionClientRecorder(base_client, mode="record", session_file_path="session.json")
# run the scenario once to capture, then switch mode back to "replay"
Defensive patterns

Strategy: validation

Validate before calling

# before replay, sanity-check the session file matches the current scenario
import json
with open(session_file_path) as f:
    records = json.load(f)
assert all("messages" in r and "response" in r for r in records), "stale or corrupt session file"

Try / catch

try:
    result = await recorder_client.create(messages)
except ValueError as e:
    if "doesn't match the recorded message list" in str(e):
        # divergence: inspect pagelogs, then re-record the session
        recorder_client = ChatCompletionClientRecorder(client, mode="record", session_file_path=session_file_path)
    else:
        raise

Prevention

When it happens

Trigger: Running a replay-mode session where the agent code, prompts, tools, or model configuration changed after the session was recorded; or where non-deterministic content (timestamps, random IDs, dict ordering) leaks into messages. Also triggered if create() is called in a different order/number of times than recorded.

Common situations: Editing agent logic or system prompts without re-recording the session; upgrading autogen versions that change message serialization; nondeterministic LLM responses because temperature wasn't pinned; extra middleware/tool calls adding messages between recorded turns.

Related errors


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