Skip to content

Conversation

@opencode-agent
Copy link
Contributor

@opencode-agent opencode-agent bot commented Jan 9, 2026

Both changes are applied. The fix adds defensive type checking in the format function to handle cases where the answer might be a string instead of an array. This can happen when loading older sessions or if data gets stored in an unexpected format.

Summary of the fix:

The bug occurred because props.metadata.answers?.[i()] could sometimes be a string instead of an array (string[]), causing answer.join(", ") to fail since strings don't have a join method.

The fix adds a type check before calling .join():

  1. If answer is falsy or empty, return the fallback text
  2. If answer is not an array, convert it to a string with String(answer)
  3. Otherwise, call .join(", ") as before

This makes the code resilient to data type variations that might occur when loading historical sessions.

Closes #7392

New%20session%20-%202026-01-09T00%3A15%3A38.209Z
opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opentui: fatal: answer.join is not a function. (In 'answer.join(", ")', 'answer.join' is undefined)

2 participants