Skip to content

fix: handle messages with missing role key#16

Open
Imgrund wants to merge 1 commit into
kauffinger:mainfrom
innobraingmbh:fix/undefined-role-key
Open

fix: handle messages with missing role key#16
Imgrund wants to merge 1 commit into
kauffinger:mainfrom
innobraingmbh:fix/undefined-role-key

Conversation

@Imgrund
Copy link
Copy Markdown

@Imgrund Imgrund commented Feb 19, 2026

Summary

  • Skip messages without a role key in the Blade @foreach loop using @continue(empty($msg['role']))
  • Filter out messages without a role key in messagesToPrism() before mapping

Problem

Messages stored in session via Livewire's #[Session] attribute can lose their role key (e.g., due to session corruption or deserialization issues), causing an Undefined array key "role" ViewException.

Sentry: INNO-BRAIN-DE-1H

Test plan

  • pint --test passes
  • Verify chat bubble works normally with valid messages
  • Verify no crash when session contains a message without role key

🤖 Generated with Claude Code

Messages stored in session via Livewire's #[Session] attribute can lose
their 'role' key due to session corruption or deserialization issues,
causing an "Undefined array key 'role'" ViewException.

- Skip messages without a role in the Blade foreach loop
- Filter out messages without a role in messagesToPrism()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant