# LibTmux.Server.snapshot_with_diagnostics/2

- **Module:** LibTmux
- **Package:** libtmux
- **Language:** Elixir
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-elixir/blob/ce52194a746ce1d6785c352a731cff734e0d11ce/lib/libtmux/server.ex#L682
- **Page:** https://libtmux.org/en/elixir/latest/reference/libtmux-server-snapshot_with_diagnostics-2/

```
snapshot_with_diagnostics(server, options \\ [])
@spec snapshot_with_diagnostics(t(), [
        LibTmux.Capture.option()
      ]) ::
        {:ok, LibTmux.Snapshot.t(),
         LibTmux.Capture.diagnostics()}
        | {:error, LibTmux.Error.t(),
           LibTmux.Capture.diagnostics()}
```

Captures a graph and returns work diagnostics on success or failure.

The options are those of `snapshot/2`. Use `commands` for calls to the
one-shot transport, including failed calls, and `bytes` for retained stdout
and stderr bytes charged to the capture budget. An overflowing response
contributes its retained prefix. Capture-wide limits can stop work before
another call is made.

Each fallback names the entity and text fields of the oversized listing,
its effective response ceiling, and the batch and individual reads
attempted after the listing retired. These counts include failed reads.
There are at most three records per capture attempt.
The diagnostics contain counts and field names. Capture errors keep their
original details, which may include captured output.

See the [worked example](observations.html#diagnose-capture-work).

## Parameters

- `server` (`t()`)
- `options` (`[LibTmux.Capture.option()]`)
  Default: `[]`.

## Guides

Pages that discuss `snapshot_with_diagnostics/2`.

- [Captured tmux state](/en/elixir/latest/concepts/observations/)
