# Yakut Error OSError: \[Errno 22\] Invalid argument

**URL:** <https://forum.opencyphal.org/t/yakut-error-oserror-errno-22-invalid-argument/1434>\
**Category:** CLI tools (Cynic/Yakut)\
**Created:** [September 14, 2021, 7:38am UTC](https://forum.opencyphal.org/t/yakut-error-oserror-errno-22-invalid-argument/1434 "2021-09-14T07:38:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaredDillon](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/j/c57346/32.png) [@JaredDillon](https://forum.opencyphal.org/u/JaredDillon)\
**Post date:** [September 14, 2021, 7:38am UTC](https://forum.opencyphal.org/t/yakut-error-oserror-errno-22-invalid-argument/1434/1 "2021-09-14T07:38:23Z")

</div>

Hey all,  
I’m in the process of trying to read the data incoming from a GNSS Node I put together from the example: [107-Arduino-GNSS-Node\_Example.ino](https://github.com/107-systems/107-Arduino-UAVCAN/tree/master/examples/UAVCAN-GNSS-Node)  
I’ve setup Yakut following the screenshare example and when using yakut monitor I get this error flashing repeatedly:

```auto
NodID Mode Health VSSC Uptime VProtcl VHardwr VSoftware(major.minor.vcs.crc) Unique-ID Name                    
    2 ? ? ? offline 1.0 0.0 0.6 32bd38c3a62734a7d218a81ee1b3be9c org.uavcan.yakut.monitor
APPLICATION LAYER CONNECTIVITY MATRIX [t/s=transfer/second] Colors: pub/cln\u2502sub/srv\u2502(pub+sub)/(cln+srv)\u2502activity\u2502uavcan.node.port.List is published/not\u2502
MESSG \u2211t/s \u2211B/s     
\u2211t/s 0 \u2196 t/s
\u2211B/s 0      
RQ+RS \u2211t/s \u2211B/s     
\u2211t/s 0 \u2196 t/s
\u2211B/s 0      
TOTAL \u2211t/s \u2211B/s     
\u2211t/s 0           
\u2211B/s 0      
Total transport layer errors: 0 Values averaged over 10.0 sec
2021-09-14 17:26:27 0004624 ERR pyuavcan.application.heartbeat_publisher: HeartbeatPublisher(heartbeat=uavcan.node.Heartbeat.1.0(uptime=22, health=uavcan.node.Health.1.0(value=0), mode=uavcan.node.Mode.1.0(value=0), vendor_specific_status_code=24), priority=NOMINAL, period=1.0) publisher task exception: [Errno 22] Invalid argument
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/application/heartbeat_publisher.py", line 203, in _task_function
    if not await pub.publish(self.make_message()):
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/presentation/_port/_publisher.py", line 113, in publish
    return await self._maybe_impl.publish(message, self._priority, self._loop.time() + self._send_timeout)
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/presentation/_port/_publisher.py", line 190, in publish
    return await self.transport_session.send(transfer, monotonic_deadline)
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/transport/can/_session/_output.py", line 206, in send
    return await self._do_send(can_id, transfer, monotonic_deadline)
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/transport/can/_session/_output.py", line 163, in _do_send
    if await self._send_handler(transaction):
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/transport/can/_can.py", line 335, in _do_send
    t.monotonic_deadline,
  File "/usr/local/lib/python3.7/dist-packages/pyuavcan/transport/can/media/socketcan/_socketcan.py", line 130, in send
    timeout=monotonic_deadline - self._loop.time(),
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 425, in sock_sendall
    return await fut
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 434, in _sock_sendall
    n = sock.send(data)
OSError: [Errno 22] Invalid argument

```

I think I’ve setup the the PATH and DSDL definitions correctly.  
For hardware on the Arduino side I’m using the MKR zero stack recommended but with a different Serial GPS, and on the raspberry pi I’m using a SEEEDuino RPI Can Shield connected via SPI, SocketCan.  
Any help in troubleshooting would be appreciated. If any more information is needed let me know.  
Thankyou

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [September 14, 2021, 7:43am UTC](https://forum.opencyphal.org/t/yakut-error-oserror-errno-22-invalid-argument/1434/2 "2021-09-14T07:43:21Z")

</div>

Add this:

```auto
export UAVCAN __CAN__ MTU=8

```

By default, Yakut uses CAN FD with MTU 64 bytes, but your network is Classic CAN with MTU 8 bytes. An attempt to write a large-MTU frame into a Classic CAN socket reults in the invalid argument error.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [September 14, 2021, 7:46am UTC](https://forum.opencyphal.org/t/yakut-error-oserror-errno-22-invalid-argument/1434/3 "2021-09-14T07:46:35Z")

</div>

Would you volunteer to add an error handler here that catches `OSError` with the invalid argument error code and re-raises it with a more sensible [`InvalidMediaConfigurationError`](https://pyuavcan.readthedocs.io/en/stable/api/pyuavcan.transport.html#pyuavcan.transport.InvalidMediaConfigurationError)? That would be a significant usability boost.

> <https://github.com/UAVCAN/pyuavcan/blob/9da3cf579b65cae4067b16c621cc3321156f17d4/pyuavcan/transport/can/media/socketcan/_socketcan.py#L127-L133>
