Mavsdk ftp list fails "Unknown error code: 3"

I’m trying to list the files on the FCU like Mission Planner does under config → MAVFtp.

I’m running Mission Planner with a Copter simulation and also running mavsdk_server inside a docker container:

/usr/local/lib/python3.10/dist-packages/mavsdk/bin/mavsdk_server "tcp://host.docker.internal:5762"

[02:41:34|Info ] MAVSDK version: v2.12.0 (mavsdk_impl.cpp:26)
[02:41:34|Info ] Waiting to discover system on tcp://host.docker.internal:5762... (connection_initiator.h:20)
[02:41:34|Debug] New system ID: 1 Comp ID: 1 (mavsdk_impl.cpp:720)
[02:41:34|Debug] Component Autopilot (1) added. (system_impl.cpp:366)
[02:41:34|Warn ] Vehicle type changed (new type: 2, old type: 0) (system_impl.cpp:217)
[02:41:34|Debug] Discovered 1 component(s) (system_impl.cpp:509)
[02:41:34|Info ] System discovered (connection_initiator.h:62)
[02:41:34|Info ] Server started (grpc_server.cpp:169)
[02:41:34|Info ] Server set to listen on (grpc_server.cpp:170)

Then, using the sample code, I get the following error:

$ ./

connecting to mavsdk server...
Waiting for drone to connect...
-- Connected to drone!
[02:50:37|Info ] Unknown error code: 3 (mavlink_ftp_client.cpp:1068)
Traceback (most recent call last):
  File "/xxxxx/./", line 24, in <module>
  File "/usr/lib/python3.10/asyncio/", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/", line 649, in run_until_complete
    return future.result()
  File "/xxxxx/./", line 19, in run
    print("directory list", await drone.ftp.list_directory("/"))
  File "/usr/local/lib/python3.10/dist-packages/mavsdk/", line 449, in list_directory
    raise FtpError(result, "list_directory()", remote_dir)
mavsdk.ftp.FtpError: PROTOCOL_ERROR: 'Protocol Error'; origin: list_directory(); params: ('/',)
Exception ignored in: <function System.__del__ at 0x7f0068bba0e0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/mavsdk/", line 88, in __del__
  File "/usr/local/lib/python3.10/dist-packages/mavsdk/", line 124, in _stop_mavsdk_server
ImportError: sys.meta_path is None, Python is likely shutting down

Needless to say, the Mission Planner MavFtp UI works well and is able to list the FCU files.

Any idea why the list fails?