# Libtmux_json.Error.encode

- **Module:** Libtmux_json
- **Package:** libtmux-json
- **Language:** OCaml
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/json/libtmux_json.mli#L27
- **Public owner:** Libtmux_json
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux_json-error-encode/

```
val encode : Libtmux.Error.t -> Yojson.Safe.t
```

Return a stable `code`, bounded `message`, `message_truncated` flag and relevant operation, resource or target metadata. Messages and text attributes retain at most 4096 bytes; invalid UTF-8 uses the tagged hex representation described by [`Workspace.encode_receipt`](/en/ocaml/latest/workspace/reference/libtmux_json-workspace-encode_receipt/). No I/O.

## Parameters

- `arg1` (`Libtmux.Error.t`)
