Skip to content

Instantly share code, notes, and snippets.

@haya14busa
Created February 22, 2021 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haya14busa/97fade1a7051df4a661a0eadbf9b1c88 to your computer and use it in GitHub Desktop.
Save haya14busa/97fade1a7051df4a661a0eadbf9b1c88 to your computer and use it in GitHub Desktop.
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4a94dd]
goroutine 1 [running]:
encoding/json.(*encodeState).marshal.func1(0xc0000962d8)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/encoding/json/encode.go:328 +0x8d
panic(0x55ba60, 0x664ee0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/runtime/panic.go:965 +0x1b9
encoding/json.(*encodeState).string(0xc00008c180, 0x0, 0x402c000000000000, 0x1)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/encoding/json/encode.go:1033 +0x5d
encoding/json.stringEncoder(0xc00008c180, 0x556a00, 0xc000010390, 0x98, 0x100)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/encoding/json/encode.go:647 +0x1d6
encoding/json.(*encodeState).reflectValue(0xc00008c180, 0x556a00, 0xc000010390, 0x98, 0xc000090100)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/encoding/json/encode.go:360 +0x82
encoding/json.(*encodeState).marshal(0xc00008c180, 0x556a00, 0xc000010390, 0xc000010100, 0x0, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/encoding/json/encode.go:332 +0xf9
encoding/json.Marshal(0x556a00, 0xc000010390, 0xc000010390, 0x55d120, 0x55a5c0, 0x55a500, 0x7f2def5a0858)
/home/linuxbrew/.linuxbrew/Cellar/go/1.16/libexec/src/encoding/json/encode.go:161 +0x52
main.(*ProgressToken).MarshalJSON(0xc000010290, 0x55a5c0, 0xc000010290, 0x7f2def5a0858, 0xc000010290, 0x0)
/home/haya14busa/tmp/gojson-panic/main.go:19 +0x5f
github.com/goccy/go-json.encodeRunEscaped(0xc000086000, 0xc000084000, 0x1, 0x400, 0xc000010380, 0x1, 0xc000083100, 0xc000083200, 0x0, 0x0, ...)
/home/haya14busa/pkg/mod/github.com/goccy/go-json@v0.4.7/encode_vm_escaped.go:3633 +0x16bd9
github.com/goccy/go-json.encodeRunCode(0xc000086000, 0xc000084000, 0x0, 0x400, 0xc000010380, 0x1, 0x5485b7, 0x56b3a0, 0xc000086000, 0x8, ...)
/home/haya14busa/pkg/mod/github.com/goccy/go-json@v0.4.7/encode.go:276 +0x74
github.com/goccy/go-json.encode(0xc000086000, 0x552560, 0xc000010290, 0x1, 0x40ce7b, 0xc000010290, 0x10, 0x10, 0x561200)
/home/haya14busa/pkg/mod/github.com/goccy/go-json@v0.4.7/encode.go:205 +0x1df
github.com/goccy/go-json.marshal(0x552560, 0xc000010290, 0x1, 0xc000068f08, 0x40d5d8, 0x10, 0x561200, 0x1)
/home/haya14busa/pkg/mod/github.com/goccy/go-json@v0.4.7/encode.go:131 +0x85
github.com/goccy/go-json.MarshalWithOption(0x552560, 0xc000010290, 0x0, 0x0, 0x0, 0x405ea5, 0xc000062058, 0x418f01, 0x0, 0x0)
/home/haya14busa/pkg/mod/github.com/goccy/go-json@v0.4.7/json.go:171 +0x76
github.com/goccy/go-json.Marshal(...)
/home/haya14busa/pkg/mod/github.com/goccy/go-json@v0.4.7/json.go:157
main.main()
/home/haya14busa/tmp/gojson-panic/main.go:42 +0x6a
exit status 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment