Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CLI 0.162.0 panics at terminal_hyperlinks.rs:392: UTF-8 boundary inside ➡ while rendering Chinese text

Closed
#52,375 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Start at remap_source_wrapped_line in codex-rs/tui/src/terminal_hyperlinks.rs near line 392, where text[source_byte..wrapped.range.start] panics. Trace where wrapped.range values come from, since the invalid offset is the upstream cause, and note that the #52330 clamp does not cover it. Done means a regression test that remaps long CJK text with emoji such as ➡️ across several wrap widths without panicking, with visible text and source mappings preserved.

Written by the indexing model from the issue text.

Description

bug CLI TUI
What version of Codex CLI is running?

codex-cli 0.162.0, installed globally via npm (@openai/codex). The npm latest endpoint also returned 0.162.0 when checked.

What subscription do you have?

Not provided.

Which model were you using?

Not confirmed for the crashing turn.

What platform is your computer?

Linux 7.0.0-38-generic x86_64 GNU/Linux.

What terminal emulator and version are you using (if applicable)?

Kitty 0.49.0, with zsh.

Codex doctor report

Not collected. No account credentials or private workspace logs are included in this report.

What issue are you seeing?

The interactive Codex CLI panicked and exited to the shell while handling a Chinese question containing emoji. The terminal retained this error:

The application panicked (crashed).
Message: end byte index 159 is not a char boundary; it is inside '➡' (bytes 158..161) of [application text omitted for privacy]
Location: tui/src/terminal_hyperlinks.rs:392

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
What steps can reproduce the bug?

This is an observed crash, not yet a deterministic end-to-end reproducer. The exact terminal dimensions and triggering UI action were not captured, and a full backtrace is unavailable.

  1. Run codex version 0.162.0 in Kitty.
  2. The affected interaction contains a long Chinese question, including ➡️ (business text omitted).
  3. The TUI exits with the panic above during source-range remapping.

The application's business text has been omitted for privacy. The original panic identifies ➡ at UTF-8 bytes 158..161; offset 159 is inside that character.

What is the expected behavior?

Rendering/wrapping Chinese text and emoji should not terminate the CLI. Source ranges used for slicing should remain valid UTF-8 boundaries and correctly map to the displayed text.

Additional information

The reported location matches the code in the 0.162.0 tag:
https://github.com/openai/codex/blob/rust-v0.162.0/codex-rs/tui/src/terminal_hyperlinks.rs#L392

Inside remap_source_wrapped_line:

source_column += display_width(&text[source_byte..wrapped.range.start]);

The panic indicates that the range start used here was inside a multibyte character. The upstream cause of the invalid wrapped range still needs investigation; this report does not establish that the arrow alone always triggers a crash.

Related change: #52330 (commit 22ebb0fb178fe369190123c256ba200585765725) clamps wrapped range offsets to text.len() to address a cursor sentinel past the end of the input. That particular clamp does not address this case: 159 is already below the input length but is not a character boundary. A local Python byte-boundary check using the reported text confirmed that min(159, len(text.encode("utf-8"))) remains 159 and the prefix still fails UTF-8 decoding. This was a boundary check only, not a Rust/TUI regression test.

Suggested investigation/regression coverage: exercise source-range remapping of long CJK questions with emoji/variation selectors across different wrap widths, and check both in-bounds character boundaries and preservation of visible text/source mappings.

Dominant language
Rust
Stars
129k
Forks
20.3k
Avg merge
1m
Merged PRs (30d)
998

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.