Skip to content

Fix gRPC crash when memo content contains invalid UTF-8#5401

Open
ManakRaj-7 wants to merge 1 commit intousememos:mainfrom
ManakRaj-7:fix/grpc-invalid-utf8-memo
Open

Fix gRPC crash when memo content contains invalid UTF-8#5401
ManakRaj-7 wants to merge 1 commit intousememos:mainfrom
ManakRaj-7:fix/grpc-invalid-utf8-memo

Conversation

@ManakRaj-7
Copy link

Fixes #5392

Problem

ListMemos can fail with: grpc: error while marshaling: string field contains invalid UTF-8 when stored memo content or derived snippet contains invalid UTF-8 data.

This causes the entire API response to fail during protobuf marshaling.

Solution

Add defensive UTF-8 validation in convertMemoFromStore before constructing protobuf responses.

If invalid UTF-8 is detected:

  • The request fails fast with a clear INTERNAL error
  • The affected memo UID is included in the error message
  • No user data is modified

Scope

  • Backend only
  • No API contract changes
  • No data mutation
  • No frontend changes

Notes

This is a diagnostic-first fix to improve API stability and observability.

Add defensive UTF-8 validation in convertMemoFromStore to prevent gRPC marshal failures when memo content or derived snippet contains invalid UTF-8 data. This fails fast with a clear INTERNAL error instead of crashing the Listen response.

Signed-off-by: Manak Raj <7manakraj@gmail.com>
@boojack boojack force-pushed the main branch 2 times, most recently from a196c72 to 71e8a06 Compare February 10, 2026 01:15
@boojack boojack self-requested a review as a code owner February 24, 2026 14:23
@boojack boojack force-pushed the main branch 2 times, most recently from 2b6b987 to 47d9414 Compare February 24, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant