# log_malformed_summarization_event

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/goal_state_notice/log_malformed_summarization_event)

Record that a restored summarization event was discarded.

Dropping the event also drops its `summary_message`, so the next request
re-sends the whole untrimmed history. That is a large, silent token and
latency cost whose only symptom is a slow, expensive turn, and the causes
worth chasing — a checkpoint written by another schema, a partial write, a
cutoff recorded against a different message list — all look identical from the
outside. Log it so a repeat is diagnosable.

Shared with the client rather than kept in the middleware: the client is the
side that reads possibly-malformed *remote snapshot* dicts, so it is the more
likely place to meet one, and a discard that is loud on one side and silent on
the other is worse than either.

## Signature

```python
log_malformed_summarization_event(
    event: object,
    message_count: int,
) -> None
```

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/e4c1ffe9ee63d7854147de490ca27495ef157a7b/libs/code/deepagents_code/goal_state_notice.py#L404)