# MatchCreation Fails with Error "cannot encode params"

**URL:** <https://forum.heroiclabs.com/t/matchcreation-fails-with-error-cannot-encode-params/638>\
**Category:** Game Design\
**Created:** [April 14, 2020, 10:36am UTC](https://forum.heroiclabs.com/t/matchcreation-fails-with-error-cannot-encode-params/638 "2020-04-14T10:36:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JunaidMkdn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/junaidmkdn/32/194_2.png) [@JunaidMkdn](https://forum.heroiclabs.com/u/JunaidMkdn)\
**Post date:** [April 14, 2020, 10:36am UTC](https://forum.heroiclabs.com/t/matchcreation-fails-with-error-cannot-encode-params/638/1 "2020-04-14T10:36:12Z")

</div>

Hello,

I am working on a game where we use nk.MatchCreate (where nk is runtime.NakamaModule in go) to create match. but occasionally nk.MatchCreate fuction fails with error “cannot encode params” , but if we try multiple time using backoff.Retry it is working fine…

we are using

```
 nk.MatchCreate(ctx, "SitNGo", CreationData)

```

where

```
 CreationData := map[string]interface{}{
	"CashTableConfig": tableConfig,
}

```

tableConfig is pointer type of

```
TableConfig struct {
houseId string
tickRate int64
isRoundTimeBound bool
roundMaxTimeSecs time.Duration
tableEndTime time.Time
blinds *Blinds

```

}

```
type Blinds struct {
big Blind
small Blind

```

}

i think like it can be because of fields are un exported in struct TableConfig? then the error should come all the time right ? but why the creation fails only in some cases?

any help would be really appreciated,  
Junaid

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [April 14, 2020, 3:08pm UTC](https://forum.heroiclabs.com/t/matchcreation-fails-with-error-cannot-encode-params/638/2 "2020-04-14T15:08:08Z")

</div>

You need to make sure any custom parameter types have exported fields (eg. `houseId` -\> `HouseId`) and the types are registered with `gob` (eg. `gob.Register(&TableConfig{})`). This is part of the process that the RPC subsystem uses to send match parameters to the Authoritative Match subsystem.

We’ll investigate the error output and consistency for the next server release. 👍

---

<div class="post-metadata">

**Author:** ![zyro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/zyro/32/14_2.png) [@zyro](https://forum.heroiclabs.com/u/zyro)\
**Post date:** [April 16, 2020, 10:22am UTC](https://forum.heroiclabs.com/t/matchcreation-fails-with-error-cannot-encode-params/638/4 "2020-04-16T10:22:24Z")

</div>

This is off topic, and I see you’ve created a new thread [here](https://forum.heroiclabs.com/t/matchterminate-function-is-not-getting-called-in-nakama-2-11-1/643). We’ll continue discussion there.
