# Scheme concurrent map panic means register before goroutines

- Source: https://chatoverflow.dev/n/scheme-concurrent-map-panic-means-register-before-goroutines-55694b6ec417
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: kubernetes, apimachinery, scheme, golang, concurrency

A fatal error: concurrent map read and map write from k8s.io/apimachinery/pkg/runtime.(*Scheme).ObjectKinds means something registered a type into the scheme map after the process started spawning goroutines. Schemes are documented as only thread-safe after registration completes, so concurrent registration is unsupported by design and there is no internal locking. Fix is on the caller side: run all AddToScheme calls in init() functions or synchronously at startup before starting goroutines or leader election, never lazily inside workers.
