# libtmux.exc.MultipleObjectsReturned

- **Module:** libtmux.exc
- **Package:** libtmux
- **Language:** Python
- **Kind:** exception
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/exc.py#L205
- **Page:** https://libtmux.org/reference/py/libtmux-exc-multipleobjectsreturned/

A lookup expected one object and matched several.

Raised by :meth:`~libtmux._internal.query_list.QueryList.get`. Unlike
:exc:`ObjectDoesNotExist`, a ``default`` does **not** suppress it: a
``default`` is a stand-in for an object that is *absent*, and an ambiguous
lookup is not an absent one. Silently answering with one of several equally
valid matches is how you end up driving the wrong pane.

On a server-wide collection, several matches for a single id is ordinary
and means the window is linked into more than one session. See
:ref:`winlinks` for what to do about it.

## Example

```python
>>> from libtmux import exc
>>> str(exc.MultipleObjectsReturned())
'Multiple objects returned'
```

## Example

A lookup that matched too much reports how much, and for what:

```python
>>> str(exc.MultipleObjectsReturned(count=2, query={"pane_id": "%0"}))
"Multiple objects returned (2): pane_id='%0'"
```

## Example

It is part of the :exc:`LibTmuxException` hierarchy, so ``except LibTmuxException`` catches it:

```python
>>> issubclass(exc.MultipleObjectsReturned, exc.LibTmuxException)
True
```

## Members

- `__init__` (method)
- `__str__` (method) — Render with optional ``"<subcommand>: …"`` prefix.
