Skip to content

[BUG] Device fails to re-appear after boot (X_LINK_DEVICE_NOT_FOUND) #1514

@TheGausi

Description

@TheGausi

Describe the bug
I created a very simple CMake project and copied the exact code from
depthai-core/examples/cpp/Camera/camera_output.cpp. The project builds successfully.
But when I run the binary I get:

terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
Aborted (core dumped)

Minimal Reproducible Example
The code is literally identical to: depthai-core/examples/cpp/Camera/camera_output.cpp
My CMakeLists.txt:

cmake_minimum_required(VERSION 3.22)
project(DEPTHAPP)
find_package(Threads)
find_package(OpenCV REQUIRED)
include(FetchContent)
FetchContent_Declare(
    fp16
    GIT_REPOSITORY https://github.com/Maratyszcza/FP16.git
    GIT_TAG master
)
FetchContent_MakeAvailable(fp16)

# Create utility library
add_library(utility /home/devcontainer/depthai-core/examples/cpp/utility/utility.cpp)
target_compile_features(utility PUBLIC cxx_std_17)
target_include_directories(utility PUBLIC "/home/devcontainer/depthai-core/examples/cpp/utility" "/work/depthapp/build/_deps/fp16-src/include")
target_link_libraries(utility ${OpenCV_LIBS})

set(TARGET depth_camera)
add_executable(${TARGET})
list(APPEND CMAKE_PREFIX_PATH "/home/devcontainer/depthai-install")
find_package(depthai CONFIG REQUIRED)
add_definitions(-DUSE_OPENCV)
message(STATUS "OpenCV included")
target_sources(${TARGET} PRIVATE "/work/depthapp/main.cpp")
set(target ${TARGET})
target_include_directories(${TARGET} PRIVATE ${OpenCV_INCLUDE_DIRS})
message(STATUS "OpenCV_INCLUDE_DIRS  ${OpenCV_INCLUDE_DIRS}")  
target_link_libraries(${TARGET} PRIVATE
            depthai::core
            ${OpenCV_LIBS}
            Threads::Threads
            utility)

set(test_env
    # Misc
    "UBSAN_OPTIONS=halt_on_error=1"
    "RUNNING_AS_TEST=1"
    # DepthAI
    "DEPTHAI_SEARCH_TIMEOUT=20000"
    "DEPTHAI_CONNECT_TIMEOUT=10000"
    "DEPTHAI_RECONNECT_TIMEOUT=0"
    )

Expected behavior
The executable should run and stream the camera frames like the official example. When I run the example directly from the cloned repository, it works. So as soon as I try to integrate the example into one of my own projects, it stops working.

Attach system log
System log:

{
    "architecture": "64bit",
    "machine": "x86_64",
    "platform": "Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.35",
    "processor": "x86_64",
    "python_build": "main Aug 15 2025 14:32:43",
    "python_compiler": "GCC 11.4.0",
    "python_implementation": "CPython",
    "python_version": "3.10.12",
    "release": "6.6.87.2-microsoft-standard-WSL2",
    "system": "Linux",
    "version": "#1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025",
    "win32_ver": "",
    "packages": [
        "bottle==0.12.25",
        "certifi==2025.8.3",
        "charset-normalizer==3.4.3",
        "conan==1.59.0",
        "distro==1.8.0",
        "fasteners==0.20",
        "idna==3.10",
        "Jinja2==3.1.6",
        "lxml==6.0.1",
        "MarkupSafe==3.0.2",
        "node-semver==0.6.1",
        "patch-ng==1.17.4",
        "pluginbase==1.0.1",
        "Pygments==2.19.2",
        "PyJWT==2.10.1",
        "python-dateutil==2.9.0.post0",
        "PyYAML==6.0",
        "requests==2.32.5",
        "six==1.16.0",
        "tqdm==4.67.1",
        "unittest-xml-reporting==3.2.0",
        "urllib3==1.26.20"
    ],
    "usb": [
        "NoLib"
    ],
    "uname": [
        "Linux 59b6b55a7d80 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 x86_64"
    ]
}

Additional context
App logs (DEPTHAI_LEVEL="trace" and XLINK_LEVEL="debug"):

[2025-11-05 11:50:46.165] [depthai] [info] Environment variable DEPTHAI_DEBUG is not set. Using default value: ''
[2025-11-05 11:50:46.166] [depthai] [info] Environment variable DEPTHAI_SEARCH_TIMEOUT is not set. Using default value: ''
[2025-11-05 11:50:46.166] [depthai] [info] Environment variable DEPTHAI_INSTALL_SIGNAL_HANDLER is not set. Using default value: ''
[2025-11-05 11:50:46.166] [depthai] [info] Environment variable DEPTHAI_LIBUSB_ANDROID_JAVAVM is not set. Using default value: ''
[2025-11-05 11:50:46.166] [depthai] [debug] Library information - version: 3.1.0, commit: 89fd1e837fe1c64e8250036ccc6ec7fcd706ad6e from 2025-10-15 10:15:47 +0200, build: 2025-10-21 11:08:00 +0000, libusb enabled: true
[2025-11-05 11:50:46.177] [depthai] [info] Environment variable DEPTHAI_PROFILING is not set. Using default value: ''
[2025-11-05 11:50:46.180] [depthai] [debug] Initialize - finished
[2025-11-05 11:50:46.180] [depthai] [info] Environment variable DEPTHAI_PROTOCOL is not set. Using default value: ''
�[37mD: [global] [    446180] [depth_camera] getLibusbDeviceMxId:422	Sending MXID read to 1.1, try 1
�[0m
�[37mD: [global] [    446185] [depth_camera] getLibusbDeviceMxId:521	Cached MX ID 14442C10A123DAD600 at index 0�[0m
�[37mD: [global] [    446185] [depth_camera] getUSBDevices:179	getLibusbDeviceMxId returned: Success�[0m
[2025-11-05 11:50:46.233] [depthai] [info] Environment variable DEPTHAI_DEVICE_MXID_LIST is not set. Using default value: ''
[2025-11-05 11:50:46.233] [depthai] [info] Environment variable DEPTHAI_DEVICE_ID_LIST is not set. Using default value: ''
[2025-11-05 11:50:46.233] [depthai] [info] Environment variable DEPTHAI_DEVICE_NAME_LIST is not set. Using default value: ''
[2025-11-05 11:50:46.233] [depthai] [info] Adding device to the filtered list: DeviceInfo(name=1.1, deviceId=14442C10A123DAD600, X_LINK_UNBOOTED, X_LINK_USB_VSC, X_LINK_MYRIAD_X, X_LINK_SUCCESS)
[2025-11-05 11:50:46.234] [host] [debug] Device - OpenVINO version: universal
[2025-11-05 11:50:46.234] [depthai] [info] Environment variable DEPTHAI_WATCHDOG is not set. Using default value: ''
[2025-11-05 11:50:46.234] [depthai] [info] Environment variable DEPTHAI_WATCHDOG_INITIAL_DELAY is not set. Using default value: ''
[14442C10A123DAD600] [1.1] [1762343446.236] [host] [debug] Device - BoardConfig: {"camera":[],"defaultImuExtr":{},"emmc":null,"gpio":[],"imu":null,"logDevicePrints":null,"logPath":null,"logSizeMax":null,"logVerbosity":null,"network":{"mtu":0,"xlinkTcpNoDelay":true},"nonExclusiveMode":false,"pcieInternalClock":null,"sysctl":[],"uart":[],"usb":{"flashBootedPid":63037,"flashBootedVid":999,"manufacturer":"","maxSpeed":4,"pid":63035,"productName":"","vid":999},"usb3PhyInternalClock":null,"uvc":null,"watchdogInitialDelayMs":null,"watchdogTimeoutMs":null} 
libnop:
0000: b9 13 b9 07 81 e7 03 81 3b f6 81 e7 03 81 3d f6 04 bd 00 bd 00 b9 02 00 01 ba 00 be be bb 00 bb
0020: 00 be be be be be be be 00 bb 00 be be bb 00
[2025-11-05 11:50:46.277] [depthai] [debug] Resources - Archive 'depthai-bootloader-fwp-0.0.28.tar.xz' open: 5ms, archive read: 102ms
[2025-11-05 11:50:46.840] [depthai] [debug] Resources - Archive 'depthai-device-fwp-0ada9b9800478cf2c7056cea5c2bab2c8f6a2cbd.tar.xz' open: 5ms, archive read: 665ms
[2025-11-05 11:50:46.841] [depthai] [info] Environment variable DEPTHAI_DEVICE_BINARY is not set. Using default value: ''
[2025-11-05 11:50:46.899] [depthai] [info] Environment variable DEPTHAI_CONNECT_TIMEOUT is not set. Using default value: ''
[2025-11-05 11:50:46.899] [depthai] [info] Environment variable DEPTHAI_BOOTUP_TIMEOUT is not set. Using default value: ''
�[37mD: [global] [    446900] [depth_camera] getLibusbDeviceMxId:422	Sending MXID read to 1.1, try 1
�[0m
�[37mD: [global] [    446902] [depth_camera] getLibusbDeviceMxId:521	Cached MX ID 14442C10A123DAD600 at index 0�[0m
�[37mD: [global] [    446902] [depth_camera] getUSBDevices:179	getLibusbDeviceMxId returned: Success�[0m
�[37mD: [global] [    446903] [depth_camera] usb_open_device:609	Found EP 0x81 : max packet size is 512 bytes�[0m
�[37mD: [global] [    446903] [depth_camera] usb_open_device:609	Found EP 0x01 : max packet size is 512 bytes�[0m
�[37mD: [global] [    446903] [depth_camera] send_file:644	Performing bulk write of 40 bytes...�[0m
�[37mD: [global] [    446903] [depth_camera] send_file:672	Successfully sent 40 bytes of data in 0.062263 ms (0.000613 MB/s)�[0m
�[37mD: [global] [    446904] [depth_camera] send_file:644	Performing bulk write of 28757443 bytes...�[0m
�[37mD: [global] [    449095] [depth_camera] send_file:672	Successfully sent 28757443 bytes of data in 12.520437 ms (2.190438 MB/s)�[0m
�[37mD: [global] [    449095] [depth_camera] usbPlatformBootFirmware:989	Boot successful, device address 1.1�[0m
[2025-11-05 11:50:49.095] [depthai] [debug] Searching for booted device: DeviceInfo(name=1.1, deviceId=14442C10A123DAD600, X_LINK_BOOTED, X_LINK_USB_VSC, X_LINK_MYRIAD_X, X_LINK_SUCCESS), name used as hint only

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions