# Types & Errors (/sdks/go/reference/types-and-errors)



The Go SDK models messages as structs with fluent setters, exposes typed poll/command/query responses, and surfaces transport failures as `*KubeMQError` with stable error codes.

## Common message types [#common-message-types]

| Type                          | Role                             |
| ----------------------------- | -------------------------------- |
| `Event` / `EventStore`        | Pub/sub payloads                 |
| `QueueMessage`                | Durable queue payload + `Policy` |
| `Command` / `Query`           | RPC requests                     |
| `CommandReply` / `QueryReply` | RPC responses                    |

Factory helpers (`NewQueueMessage`, `NewCommand`, etc.) pre-fill client ID where applicable.

## Response types [#response-types]

| Type                                | Returned from                              |
| ----------------------------------- | ------------------------------------------ |
| `QueueSendResult`                   | `SendQueueMessage`, upstream batch results |
| `PollResponse`                      | `PollQueue`, downstream `Poll`             |
| `CommandResponse` / `QueryResponse` | `SendCommand`, `SendQuery`                 |
| `EventStoreResult`                  | `SendEventStore`                           |

## Error model [#error-model]

`KubeMQError` implements `error` and exposes the `Code` and `IsRetryable` fields plus transport metadata.

| Code                    | Retryable | Typical cause                              |
| ----------------------- | --------- | ------------------------------------------ |
| `ErrCodeTimeout`        | Yes       | Deadline exceeded                          |
| `ErrCodeTransient`      | Yes       | Network drop or server busy / backpressure |
| `ErrCodeAuthentication` | No        | Invalid token                              |
| `ErrCodeValidation`     | No        | Invalid channel or message                 |

> **Note:** Subscription callbacks should not block; offload heavy work to worker goroutines to avoid stalling the gRPC stream.

## Resources [#resources]

* [GitHub Repository](https://github.com/kubemq-io/kubemq-go)
* [Go Package Reference](https://pkg.go.dev/github.com/kubemq-io/kubemq-go/v2)
* [Examples](/sdks/go/how-to)

## See Also [#see-also]

* [Go SDK Getting Started](/sdks/go)
