# acp_thread: Clarify max token limit error message \(\#52724\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/f18c963c7956fa0c51cf4095637989c0c101d376)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: f18c963c7956fa0c51cf4095637989c0c101d376

Requested commit: f18c963c7956fa0c51cf4095637989c0c101d376

Commit: f18c963c7956fa0c51cf4095637989c0c101d376

Tree: 09574e83965fb89cda0c8934d200d1a4f05396d7

Author: Om Chillure

Committer: GitHub

## Message

```
acp_thread: Clarify max token limit error message (#52724)

When generation stops due to the per-response output limit, Zed was
surfacing "Max tokens reached", which implies the full context window
was exhausted. In reality, `max_output_tokens` (the per-response cap)
may have been hit a different condition.

This change distinguishes between the two cases: if `output_tokens >=
max_output_tokens`, it surfaces "Maximum output tokens reached";
otherwise it falls back to "Maximum tokens reached".

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #50254


Note : Reopens #50372 suggested by @bennetbo 

Release Notes:

- Fixed misleading "Max tokens reached" error by distinguishing between
per-response output token limit and total context window limit.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
```

## Parents

- [8e19c7474e38cceab8b6adb331a82af0e2c0e01e](https://git.cafe/gitcafe/zed/commit/8e19c7474e38cceab8b6adb331a82af0e2c0e01e?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/f18c963c7956fa0c51cf4095637989c0c101d376?format=markdown)
