Builds an error message string that also incorporates the cause chain.
Node's fetch (undici) throws TypeError: fetch failed while the actionable reason
(e.g. ECONNREFUSED, ENOTFOUND, a TLS error) lives on error.cause. Provider SDKs often
wrap that again. This walks the chain and appends each distinct cause message/code.
Because the RPC error extension only serializes code, data, message, name and stack
(see rpc-message-encoder.ts), the cause is gone by the time a frontend agent sees a backend
error. The node-side language model frontend delegate therefore flattens the chain into the
messagebefore the error crosses the RPC boundary, so the actionable reason survives. Frontend
consumers can still call this defensively for locally thrown errors that keep their cause.
Builds an error message string that also incorporates the
causechain.Node's
fetch(undici) throwsTypeError: fetch failedwhile the actionable reason (e.g.ECONNREFUSED,ENOTFOUND, a TLS error) lives onerror.cause. Provider SDKs often wrap that again. This walks the chain and appends each distinct cause message/code.Because the RPC error extension only serializes
code,data,message,nameandstack(seerpc-message-encoder.ts), thecauseis gone by the time a frontend agent sees a backend error. The node-side language model frontend delegate therefore flattens the chain into themessagebefore the error crosses the RPC boundary, so the actionable reason survives. Frontend consumers can still call this defensively for locally thrown errors that keep theircause.