microsoft/autogen · error · ValueError

Failed to parse ledger information after multiple retries.

Error message

Failed to parse ledger information after multiple retries.

What it means

The MagenticOne orchestrator raises ValueError when the progress ledger could not be parsed or validated after its internal retry attempts are exhausted. Each retry re-calls the model; persistent JSONDecodeError, TypeError, or missing required ledger keys (key_error) makes the loop give up.

Source

Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py:384

                        break

                # Validate the next speaker if the task is not yet complete
                if (
                    not progress_ledger["is_request_satisfied"]["answer"]
                    and progress_ledger["next_speaker"]["answer"] not in self._participant_names
                ):
                    key_error = True
                    break

                if not key_error:
                    break
                await self._log_message(f"Failed to parse ledger information, retrying: {ledger_str}")
            except (json.JSONDecodeError, TypeError):
                key_error = True
                await self._log_message("Invalid ledger format encountered, retrying...")
                continue
        if key_error:
            raise ValueError("Failed to parse ledger information after multiple retries.")
        await self._log_message(f"Progress Ledger: {progress_ledger}")

        # Check for task completion
        if progress_ledger["is_request_satisfied"]["answer"]:
            await self._log_message("Task completed, preparing final answer...")
            await self._prepare_final_answer(progress_ledger["is_request_satisfied"]["reason"], cancellation_token)
            return

        # Check for stalling
        if not progress_ledger["is_progress_being_made"]["answer"]:
            self._n_stalls += 1
        elif progress_ledger["is_in_loop"]["answer"]:
            self._n_stalls += 1
        else:
            self._n_stalls = max(0, self._n_stalls - 1)

        # Too much stalling
        if self._n_stalls >= self._max_stalls:

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Switch the MagenticOne model_client to a stronger instruction-following model with JSON mode support.
  2. Check logs for 'Failed to parse ledger information, retrying: ...' to see the raw malformed output and address the cause (truncation, wrong schema, prose).
  3. Increase max_turns is not the fix — instead reduce prompt complexity or number of participants so the ledger prompt is easier for the model.
  4. Catch ValueError around run_stream/run_task and surface a clear message to retry the task; MagenticOne's ledger parsing is inherently probabilistic.

Example fix

# before
try:
    await team.run(task="...")
except ValueError as e:  # 'Failed to parse ledger information after multiple retries.'
    raise

# after
from autogen_agentchat.base import TaskResult
try:
    result = await team.run(task="...")
except ValueError:
    # retry once with a fresh team state; ledger parsing is model-dependent
    await team.reset()
    result = await team.run(task="...")
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(2):
    try:
        result = await team.run(task=task)
        break
    except ValueError as e:
        if "Failed to parse ledger" not in str(e) or attempt == 1:
            raise
        await team.reset()

Prevention

When it happens

Trigger: The ledger model repeatedly returns output that either fails json parsing, extracts to != 1 object, or lacks required keys such as is_request_satisfied / next_speaker / is_in_loop, across all retry iterations of _prepare_next_step.

Common situations: Small or local models that cannot follow the complex progress-ledger schema; rate-limited or truncated completions that cut the JSON mid-object; a client that returns non-string content the assert/extract path chokes on.

Understand the failure class

Related errors


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