Error map

panic: assignment to entry in nil map Go: panic: assignment to entry in nil map

Go · layer 4, Application & API

Open the full error page →

Centre: this error. First ring: errors it is linked with (12). Outer ring: what those are linked with. Colours show the layer of a request each error belongs to. Click any dot to re-centre the map on it; hover to follow its connections. The centre dot opens the error page.

panic: assignment to entry in nil map — Go: panic: assignment to entry in nil map (Go)panic: assi…invalid memory address or nil pointer dereference — Go: panic: runtime error: invalid memory address or nil pointer dereference (Go)invalid memory addr…cannot assign to struct field m[k].f in map — Go: cannot assign to struct field users["bob"].Age in map (Go)cannot assign to st…fatal error: concurrent map writes — Go: fatal error: concurrent map writes (Go)fatal error: concur…fatal error: concurrent map read and map write — Go: fatal error: concurrent map read and map write (Go)fatal error: concur…panic: interface conversion — Go: panic: interface conversion: interface {} is string, not int (Go)panic: interface co…fatal error: stack overflow — Go: runtime: goroutine stack exceeds 1000000000-byte limit — fatal error: stack overflow (Go)fatal error: stack …context deadline exceeded — Go: Get "https://api.example.com": context deadline exceeded (Client.Timeout exceeded while awaiting headers) (Go)context deadline ex…context canceled — Go: context canceled (rpc error: code = Canceled desc = context canceled) (Go)context canceledjson: cannot unmarshal string into Go struct field — Go: json: cannot unmarshal string into Go struct field User.age of type int (Go)json: cannot unmars…invalid character looking for beginning of value — Go: invalid character '<' looking for beginning of value (Go)invalid character l…http: superfluous response.WriteHeader call — Go: http: superfluous response.WriteHeader call from main.handler (main.go:25) (Go)http: superfluous r…listen tcp :8080: bind: address already in use — Go: listen tcp :8080: bind: address already in use (Go)listen tcp :8080: b…SIGSEGV — Segmentation fault (core dumped) (Linux)SIGSEGVall goroutines are asleep - deadlock — Go: fatal error: all goroutines are asleep - deadlock! (Go)all goroutines are …declared and not used — Go: declared and not used: x / "fmt" imported and not used (Go)declared and not us…imported and not used — Go: ./main.go:5:2: "os" imported and not used (Go)imported and not us…undefined: x — Go: ./main.go:12:2: undefined: handler (Go)undefined: xmissing return — Go: ./main.go:18:1: missing return (Go)missing returnpanic: send on closed channel — Go: panic: send on closed channel (Go)panic: send on clos…panic: close of closed channel — Go: panic: close of closed channel (or close of nil channel) (Go)panic: close of clo…panic: sync: negative WaitGroup counter — Go: panic: sync: negative WaitGroup counter (Go)panic: sync: negati…WARNING: DATA RACE — Go: WARNING: DATA RACE — Write at 0x00c0000 by goroutine 7: / Previous read at ... by goroutine 6 (Go)WARNING: DATA RACEdoes not implement interface (missing method) — Go: cannot use &Dog{} (value of type *Dog) as Animal value: *Dog does not implement Animal (missing method Speak) (Go)does not implement …panic: runtime error: index out of range — Go: panic: runtime error: index out of range [3] with length 3 (Go)panic: runtime erro…panic: slice bounds out of range — Go: panic: runtime error: slice bounds out of range [:5] with capacity 3 (Go)panic: slice bounds…panic: runtime error: integer divide by zero — Go: panic: runtime error: integer divide by zero (Go)panic: runtime erro…reflect: call of reflect.Value.X on zero Value — Go: panic: reflect: call of reflect.Value.Elem on zero Value (Go)reflect: call of re…thread 'main' has overflowed its stack (SIGABRT) — Rust: thread 'main' has overflowed its stack — fatal runtime error: stack overflow (Rust)thread 'main' has o…assignment mismatch: 1 variable but f returns 2 values — Go: assignment mismatch: 1 variable but os.Open returns 2 values (Go)assignment mismatch…dial tcp: connect: connection refused — Go: dial tcp 127.0.0.1:5432: connect: connection refused (Go)dial tcp: connect: …too many open files — Go: accept tcp [::]:8080: accept4: too many open files / open x: too many open files (Go)too many open filessql: database is closed / driver: bad connection — Go: sql: database is closed (Go)sql: database is cl…cannot refer to unexported name — Go: cannot refer to unexported name pkg.helper (undefined: pkg.helper) (Go)cannot refer to une…x509: certificate signed by unknown authority — Go: x509: certificate signed by unknown authority (Go)x509: certificate s…Client.Timeout exceeded while awaiting headers — Go: net/http: request canceled (Client.Timeout exceeded while awaiting headers) (Go)Client.Timeout exce…port is already allocated — Docker: Bind for 0.0.0.0:80 failed: port is already allocated (Docker)port is already all…network not found — Error response from daemon: network X not found (Docker)network not foundPool overlaps — Error response from daemon: Pool overlaps with other one on this address space (Docker)Pool overlaps

Directly related (12)

invalid memory address or nil pointer dereferenceGo

Go: panic: runtime error: invalid memory address or nil pointer dereference

The program used a pointer, map, interface or struct field that was nil — usually an uninitialised value or an ignored error.

cannot assign to struct field m[k].f in mapGo

Go: cannot assign to struct field users["bob"].Age in map

Map values are not addressable, so you cannot modify a field of a struct stored directly in a map.

fatal error: concurrent map writesGo

Go: fatal error: concurrent map writes

Two goroutines wrote to the same map at the same time; the runtime detects it and aborts the program (not recoverable).

fatal error: concurrent map read and map writeGo

Go: fatal error: concurrent map read and map write

One goroutine read from a map while another wrote to it; the runtime aborts.

panic: interface conversionGo

Go: panic: interface conversion: interface {} is string, not int

A type assertion `x.(T)` failed because the dynamic type of the interface is not T.

fatal error: stack overflowGo

Go: runtime: goroutine stack exceeds 1000000000-byte limit — fatal error: stack overflow

Unbounded recursion consumed the goroutine's stack until it hit the 1 GB limit.

context deadline exceededGo

Go: Get "https://api.example.com": context deadline exceeded (Client.Timeout exceeded while awaiting headers)

An operation did not finish before its context deadline or HTTP client timeout.

context canceledGo

Go: context canceled (rpc error: code = Canceled desc = context canceled)

The context was cancelled before the operation finished — the caller gave up, the client disconnected, or a parent was cancelled.

json: cannot unmarshal string into Go struct fieldGo

Go: json: cannot unmarshal string into Go struct field User.age of type int

The JSON value's type does not match the Go field type (string vs number, object vs array).

invalid character looking for beginning of valueGo

Go: invalid character '<' looking for beginning of value

The decoder received something that is not JSON — often an HTML error page, an empty body or plain text.

http: superfluous response.WriteHeader callGo

Go: http: superfluous response.WriteHeader call from main.handler (main.go:25)

A handler wrote the status header more than once, or wrote the body first (which sends 200) and then tried to set another status.

listen tcp :8080: bind: address already in useGo

Go: listen tcp :8080: bind: address already in use

The port your Go server wants is already taken by another process (or a previous instance of your app).

Two steps away (26)

SIGSEGVLinux

Segmentation fault (core dumped)

A program accessed memory it wasn’t allowed to, and the kernel killed it with SIGSEGV (exit code 139).

all goroutines are asleep - deadlockGo

Go: fatal error: all goroutines are asleep - deadlock!

Every goroutine is blocked waiting (on a channel, mutex or WaitGroup), so the program can never continue.

declared and not usedGo

Go: declared and not used: x / "fmt" imported and not used

Go refuses to compile code with unused local variables or unused imports.

imported and not usedGo

Go: ./main.go:5:2: "os" imported and not used

The file imports a package that no code in that file uses; Go treats this as a compile error, not a warning.

undefined: xGo

Go: ./main.go:12:2: undefined: handler

The compiler cannot find an identifier — a typo, a missing import, or it lives in another file/package that wasn't built.

missing returnGo

Go: ./main.go:18:1: missing return

A function with a return type can reach its end without a return statement on some path.

panic: send on closed channelGo

Go: panic: send on closed channel

A goroutine sent a value to a channel after it had been closed.

panic: close of closed channelGo

Go: panic: close of closed channel (or close of nil channel)

`close(ch)` was called twice, or on a nil channel.

panic: sync: negative WaitGroup counterGo

Go: panic: sync: negative WaitGroup counter

`wg.Done()` was called more times than `wg.Add()`.

WARNING: DATA RACEGo

Go: WARNING: DATA RACE — Write at 0x00c0000 by goroutine 7: / Previous read at ... by goroutine 6

The race detector (`-race`) observed two goroutines accessing the same memory concurrently with at least one write and no synchro…

does not implement interface (missing method)Go

Go: cannot use &Dog{} (value of type *Dog) as Animal value: *Dog does not implement Animal (missing method Speak)

A type was used as an interface but lacks a method or has it with a different signature or receiver type.

panic: runtime error: index out of rangeGo

Go: panic: runtime error: index out of range [3] with length 3

Code accessed a slice, array or string element beyond its length.

panic: slice bounds out of rangeGo

Go: panic: runtime error: slice bounds out of range [:5] with capacity 3

A slice expression `s[a:b]` used bounds outside the slice's length or capacity.

panic: runtime error: integer divide by zeroGo

Go: panic: runtime error: integer divide by zero

Integer division or modulo by zero.

reflect: call of reflect.Value.X on zero ValueGo

Go: panic: reflect: call of reflect.Value.Elem on zero Value

Reflection code operated on an invalid (zero) `reflect.Value`, often derived from a nil pointer or a missing struct field.

thread 'main' has overflowed its stack (SIGABRT)Rust

Rust: thread 'main' has overflowed its stack — fatal runtime error: stack overflow

Recursion (or huge stack allocations) exhausted the thread's stack.

assignment mismatch: 1 variable but f returns 2 valuesGo

Go: assignment mismatch: 1 variable but os.Open returns 2 values

The number of variables on the left does not match the number of values the function returns.

dial tcp: connect: connection refusedGo

Go: dial tcp 127.0.0.1:5432: connect: connection refused

Nothing is listening on the host and port your Go program tried to connect to.

too many open filesGo

Go: accept tcp [::]:8080: accept4: too many open files / open x: too many open files

The process reached its file-descriptor limit — usually leaked connections, files or response bodies.

sql: database is closed / driver: bad connectionGo

Go: sql: database is closed

The `*sql.DB` handle was closed (or the connection died) before the query ran.

cannot refer to unexported nameGo

Go: cannot refer to unexported name pkg.helper (undefined: pkg.helper)

You used a lowercase (unexported) identifier from another package; only capitalised names are visible outside their package.

x509: certificate signed by unknown authorityGo

Go: x509: certificate signed by unknown authority

The Go TLS client does not trust the CA that signed the server's certificate.

Client.Timeout exceeded while awaiting headersGo

Go: net/http: request canceled (Client.Timeout exceeded while awaiting headers)

An `http.Client` with a Timeout gave up waiting for the server's response headers.

port is already allocatedDocker

Docker: Bind for 0.0.0.0:80 failed: port is already allocated

Another container or host process already publishes that host port.

network not foundDocker

Error response from daemon: network X not found

The container or Compose project refers to a Docker network that doesn’t exist (any more).

Pool overlapsDocker

Error response from daemon: Pool overlaps with other one on this address space

Docker tried to create a network whose subnet clashes with an existing Docker network (or a VPN/host route).