#8144·effect

Logger.consoleJson does not format Error correctly

Author: StefanWerWCreated Sep 9, 2026Updated Sep 9, 2026
Labelsbug

What version of Effect is running?

4.0.0-rc.112

What steps can reproduce the bug?

The Logger.consoleJson logger does not log correctly Errors that are not Data.TaggedError. The error message is not included in the logs. Minimal reproducible example: https://effect.website/play#a737a4f170c5

OR the code:

typescript
import { NodeRuntime } from "@effect/platform-node"
import { Effect, Logger } from "effect"

const program = Effect.gen(function*() {
  yield* Effect.fail(new Error("This message is currently not parsed"))
}).pipe(
  Effect.tapError(Effect.logError),
  Effect.catch(() => Effect.succeed(""))
)

NodeRuntime.runMain(program.pipe(
  Effect.provide(Logger.layer([Logger.consoleJson]))
  //Effect.provide(Logger.layer([Logger.consoleStructured]))
))

{"message":{},"level":"ERROR","timestamp":"2026-09-09T11:07:49.837Z","annotations":{},"spans":{},"fiberId":"#2"}

What is the expected behavior?

To have something similar to Logger.formatStructured

{"message":"Error: This message is currently not parsed","level":"ERROR","timestamp":"2026-09-09T11:00:20.270Z","annotations":{},"spans":{},"fiberId":"#2"}

What do you see instead?

{"message":{},"level":"ERROR","timestamp":"2026-09-09T11:00:20.270Z","annotations":{},"spans":{},"fiberId":"#2"}

Additional information

I think the problem is in Formatter.formatJson, maybe we need a epecial case for isntaceof Error.