Skip to content

Bug: RpcSerialization.msgPack silently swallows decode errors #6170

@IGassmann

Description

@IGassmann

What version of Effect is running?

@effect/rpc 0.75.0

What steps can reproduce the bug?

The decode function in RpcSerialization.msgPack catches all errors from unpackr.unpackMultiple() and returns an empty array for any non-incomplete error:

decode: (bytes) => {
  // ...
  try {
    return unpackr.unpackMultiple(buf)
  } catch (error_) {
    const error = error_ as any
    if (error.incomplete) {
      incomplete = buf.subarray(error.lastPosition)
      return error.values ?? []
    }
    return []  // ← all other errors silently return empty array
  }
}

Any error that isn't an incomplete chunking error — corrupted data, encoding mismatches, runtime restrictions on new Function() (see #6169) — is silently discarded. The caller receives an empty array as if no messages were sent.

What is the expected behavior?

Non-incomplete decode errors should propagate (or at minimum be logged). These represent genuine failures — corrupted data, incompatible serialization settings, or environment restrictions — not expected chunking boundaries.

What do you see instead?

Errors are silently swallowed and an empty array is returned. RPC calls fail with no indication of what went wrong, making debugging extremely difficult. In the case of #6169, this masked the root cause for weeks.

Additional information

The incomplete error handling is correct and necessary — msgpackr uses it for chunked stream processing. But the catch-all return [] fallback conflates expected chunking with unexpected failures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions