fatal error: all goroutines are asleep - deadlock!
Root Cause
JSONHandler.Handle() in json_handler.go:18 calls log.Println() to output the JSON. However, since simplelog replaces the default slog handler via init(), and Go 1.22+ bridges the standard log package through slog, this creates a recursive call:
log.Println() routes back through slog → MultiplexHandler.Handle() → JSONHandler.Handle()
Deadlock on the log.Logger mutex
This only triggers when output is not a TTY (i.e. when JSONHandler is selected instead of ConsoleHandler), which is why it may not have been caught during interactive development.
Fix
Replace log.Println() in JSONHandler.Handle() with a direct write to os.Stdout (e.g. fmt.Println or os.Stdout.Write), avoiding the log package entirely.
## Problem
Running the README example causes a deadlock:
```
fatal error: all goroutines are asleep - deadlock!
```
## Root Cause
`JSONHandler.Handle()` in `json_handler.go:18` calls `log.Println()` to output the JSON. However, since `simplelog` replaces the default `slog` handler via `init()`, and Go 1.22+ bridges the standard `log` package through `slog`, this creates a recursive call:
1. `slog.Info()` → `MultiplexHandler.Handle()` → `JSONHandler.Handle()`
2. `JSONHandler.Handle()` calls `log.Println()`
3. `log.Println()` routes back through `slog` → `MultiplexHandler.Handle()` → `JSONHandler.Handle()`
4. Deadlock on the `log.Logger` mutex
This only triggers when output is **not** a TTY (i.e. when `JSONHandler` is selected instead of `ConsoleHandler`), which is why it may not have been caught during interactive development.
## Fix
Replace `log.Println()` in `JSONHandler.Handle()` with a direct write to `os.Stdout` (e.g. `fmt.Println` or `os.Stdout.Write`), avoiding the `log` package entirely.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Running the README example causes a deadlock:
Root Cause
JSONHandler.Handle()injson_handler.go:18callslog.Println()to output the JSON. However, sincesimplelogreplaces the defaultsloghandler viainit(), and Go 1.22+ bridges the standardlogpackage throughslog, this creates a recursive call:slog.Info()→MultiplexHandler.Handle()→JSONHandler.Handle()JSONHandler.Handle()callslog.Println()log.Println()routes back throughslog→MultiplexHandler.Handle()→JSONHandler.Handle()log.LoggermutexThis only triggers when output is not a TTY (i.e. when
JSONHandleris selected instead ofConsoleHandler), which is why it may not have been caught during interactive development.Fix
Replace
log.Println()inJSONHandler.Handle()with a direct write toos.Stdout(e.g.fmt.Printlnoros.Stdout.Write), avoiding thelogpackage entirely.