Decode error on struct with 'error' field using SideEffect

Can anyone tell me why does the following code gives an error?

type What struct {
	Name  string
	Error error
func MyWorkflowDefinition(ctx workflow.Context) error {
	se := workflow.SideEffect(ctx, func(ctx workflow.Context) interface{} {
		return What{Name: "test", Error: fmt.Errorf("why is this not working")}
	var res What
	err := se.Get(&res)
	if err != nil {
	return nil

err.Error() is:

payload item 0: unable to decode: json: cannot unmarshal object into Go struct field What.Error of type error

So I figured out that I can use my own Error type and that while decoding it doesn’t know which type to create instead of the interface.
Is there a best practice here? because it seems like a type that should be deserializable out of the box.

Temporal doesn’t support serialization/deserialization of polymorphic structures by default. Think about activity invocation as an RPC call to a different process. Most RPC frameworks don’t support such polymorphic calls.

If you really want this, then implement your custom DataConverter.