Codex panicked: index outside of buffer

Resolved 💬 5 comments Opened Sep 4, 2025 by nikhil-pandey Closed Dec 23, 2025
💡 Likely answer: A maintainer (easong-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.29.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

Read .....toml, .....toml, ......toml
The application panicked (crashed).

Codex:

Message:  index outside of buffer: the area is Rect { x: 0, y: 0, width: 182, height: 5 } but index is (0, 5)
Location: /Users/runner/.cargo/git/checkouts/ratatui-caae81b9af813392/9b2ad12/src/buffer/buffer.rs:253

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
The application panicked (crashed).
Message:  index outside of buffer: the area is Rect { x: 0, y: 0, width: 182, height: 5 } but index is (0, 5)
Location: /Users/runner/.cargo/git/checkouts/ratatui-caae81b9af813392/9b2ad12/src/buffer/buffer.rs:253

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

TUI Logs:

2025-09-04T09:07:16.982172Z  INFO FunctionCall: shell({"command":["bash","-lc","sed -n '1,260p' src/........toml"]})
2025-09-04T09:07:21.527541Z  INFO FunctionCall: shell({"command":["bash","-lc","sed -n '1,260p' src/.....toml"]})
2025-09-04T09:07:24.053551Z  INFO FunctionCall: shell({"command":["bash","-lc","sed -n '1,260p' src.......toml"]})
2025-09-04T09:07:24.264032Z ERROR panic: panicked at /Users/runner/.cargo/git/checkouts/ratatui-caae81b9af813392/9b2ad12/src/buffer/buffer.rs:253:13:
index outside of buffer: the area is Rect { x: 0, y: 0, width: 182, height: 5 } but index is (0, 5)

What is the expected behavior?

Should not crash

What do you see instead?

Crashed

Additional information

_No response_

View original on GitHub ↗

5 Comments

easong-openai contributor · 11 months ago

Any chance you could provide any more detail about what you were doing and your terminal size? Was this a particularly small terminal window?

Thanks!

KazamiHazaki · 11 months ago

same issues when trying to use codex with model gpt-5

```The application panicked (crashed).
Message: insertion index (is 193) should be <= len (is 192) 9106 tokens used 98% context left
LUpdating category suggestionsrs171s • Esc to inte rupt)

B^Cktrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.```

nikhil-pandey · 11 months ago

@easong-openai was asking the model to make some some edits. It was searching for the files to edit. Panicked after a few tool calls.

Don't exactly recall the setup but it was either a terminal window in cursor or vertically split (1/4) iterm.

joshua-ne · 11 months ago

Same issue when trying to init codex in a repo

etraut-openai contributor · 8 months ago

I think this was fixed long ago but we forgot to close the bug.