When logging a native Error together with structured context:
console.log(error,extra);
Cloudflare Workers Logs currently stores the error as only the stripped stack frames. However, it appears the Cloudflare platform prints .stack, so on the Observability tab of the Cloudflare worker, instead of:
Error Name: error message
at worker.js (123)...
we read:
And the error’s name and message are lost from both the top-level message and $metadata.error.
This appears to be a regression related to the recent console.*errorInfo work, specifically 21b8231
That commit deliberately changed errorInfo.stack to a stack containing only the frames.
That makes sense for the structured ErrorInfo representation, but the production Workers Logs ingestion path appears to use errorInfo.stack itself as the canonical log message without recombining it with errorInfo.name and errorInfo.message.
Minimal reproduction
Deploy the following code as a new Worker:
exportdefault{fetch(){consterr=newTypeError("CF_ERROR_MESSAGE_SENTINEL");console.error(err,{extra: {sentinel: "CF_EXTRA_SENTINEL",},});returnnewResponse("ok");},};Then, running a request against this worker, I expect to see TypeError: CF_ERROR_MESSAGE_SENTINEL displayed in the Observability tab, but instead:

In particular, the original Error.name and Error.message are nowhere in the ingested event.
I was not sure where I should post this issue, because it has more to do with the Cloudflare platform than workerd, so I'm filing it here because 21b8231 appears to be the commit that broke the error-logging contract.
When logging a native
Errortogether with structured context:Cloudflare Workers Logs currently stores the error as only the stripped stack frames. However, it appears the Cloudflare platform prints
.stack, so on the Observability tab of the Cloudflare worker, instead of:we read:
And the error’s
nameandmessageare lost from both the top-levelmessageand$metadata.error.This appears to be a regression related to the recent
console.*errorInfowork, specifically 21b8231That commit deliberately changed
errorInfo.stackto a stack containing only the frames.That makes sense for the structured
ErrorInforepresentation, but the production Workers Logs ingestion path appears to useerrorInfo.stackitself as the canonical log message without recombining it witherrorInfo.nameanderrorInfo.message.Minimal reproduction
Deploy the following code as a new Worker:
Then, running a request against this worker, I expect to see
TypeError: CF_ERROR_MESSAGE_SENTINELdisplayed in the Observability tab, but instead:In particular, the original
Error.nameandError.messageare nowhere in the ingested event.