codex icon indicating copy to clipboard operation
codex copied to clipboard

Codex panicked: index outside of buffer

Open nikhil-pandey opened this issue 1 year ago • 5 comments

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

nikhil-pandey avatar Sep 04 '25 09:09 nikhil-pandey

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!

easong-openai avatar Sep 04 '25 17:09 easong-openai

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

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.```

KazamiHazaki avatar Sep 06 '25 07:09 KazamiHazaki

@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.

nikhil-pandey avatar Sep 06 '25 10:09 nikhil-pandey

Same issue when trying to init codex in a repo

joshua-ne avatar Sep 08 '25 09:09 joshua-ne

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

etraut-openai avatar Dec 23 '25 04:12 etraut-openai