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

  1. Compare versions
    strings /usr/lib/librknnrt.so | grep -i 'librknnrt version'
    pip show rknn-toolkit2   # on the conversion host
  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
    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

Building a Rockchip-based product?

From hardware design to Linux, Android and AI integration, get engineering support for your Rockchip project.