RKNN "rknn_init fail! ret=-6" RKNN_ERR_MODEL_INVALID: Fix
rknn_init fail! ret=-6 (RKNN_ERR_MODEL_INVALID)
The RKNN runtime rejected the .rknn file. Usually the model was converted with a toolkit version the board's librknnrt does not support, or for a different target platform.
Applies to: RK3588 RK3588S RK3576 RK3568 RK3566 RK3562 RV1106 RV1103
Symptoms
- rknn_init() returns -6 in C, or init_runtime fails in RKNN-Toolkit-Lite2
- The same model works on another board or image
Common causes
- RKNN-Toolkit2 version newer than the librknnrt.so on the board
- Model exported for a different target_platform (e.g. rk3568 model on rk3588)
- Truncated or corrupted .rknn file (git-lfs pointer, partial copy)
How to fix it
- Compare versions
strings /usr/lib/librknnrt.so | grep -i 'librknnrt version' pip show rknn-toolkit2 # on the conversion host - Align runtime and toolkit
Either update librknnrt.so (and the NPU driver if required) on the board to match the toolkit, or convert again with the toolkit version matching the board runtime.
- Re-export for the right platform
rknn.config(target_platform='rk3588') # match the board SoC
Go deeper
FAQ
What does "rknn_init fail! ret=-6 (RKNN_ERR_MODEL_INVALID)" mean?
The RKNN runtime rejected the .rknn file. Usually the model was converted with a toolkit version the board's librknnrt does not support, or for a different target platform.
What causes "rknn_init fail! ret=-6 (RKNN_ERR_MODEL_INVALID)"?
RKNN-Toolkit2 version newer than the librknnrt.so on the board; Model exported for a different target_platform (e.g. rk3568 model on rk3588); Truncated or corrupted .rknn file (git-lfs pointer, partial copy).
How do I fix "rknn_init fail! ret=-6 (RKNN_ERR_MODEL_INVALID)"?
1. Compare versions 2. Align runtime and toolkit: Either update librknnrt.so (and the NPU driver if required) on the board to match the toolkit, or convert again with the toolkit version matching the board runtime. 3. Re-export for the right platform
Related issues
PCIe Link FailRockchip "PCIe Link Fail" / "Phy link never came up": NVMe Not Detectedstmmac_open: Cannot attach to PHY (error: -19)Rockchip Ethernet "Cannot attach to PHY (error: -19)": FixLink is Up - 1Gbps/Full but no DHCP / no trafficRockchip Ethernet Link Up but No Traffic (RGMII tx_delay / rx_delay)RKNN_ERR_TARGET_PLATFORM_UNMATCH (-13)RKNN_ERR_TARGET_PLATFORM_UNMATCH (-13): Model Built for Another SoCVIDIOC_STREAMON returned -1 (Broken pipe)Rockchip Camera "VIDIOC_STREAMON returned -1 (Broken pipe)": Fix[drm] Cannot find any crtc or sizesRockchip HDMI No Display: "[drm] Cannot find any crtc or sizes"