# goal_notice_size_error

> **Function** in `deepagents_code`

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

Return why `state` cannot render as a safe notice, or `None` when it can.

Collapses the project-then-validate sequence its callers each performed
separately. Their correctness depended on all of them projecting exactly as
the renderer does — the fragility `notice_text_sections` warns about — so one
implementation is the point rather than the brevity.

## Signature

```python
goal_notice_size_error(
    state: Mapping[str, object],
    *,
    criteria_override: str | None = None,
) -> GoalStateSizeError | None
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `state` | `Mapping[str, object]` | Yes | Authoritative goal and rubric channels. |
| `criteria_override` | `str \| None` | No | Candidate criteria to validate in place of the ones `state` projects, for a rubric that is not committed yet. `None` uses the projected criteria. (default: `None`) |

## Returns

`GoalStateSizeError | None`

The rejection, or `None` when the notice text fits.

---

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