Skip to content

Troubleshooting

Errors you are likely to meet, what causes them, and where to look. Error types are described in the error reference; RUST_LOG=debug adds the backend's own log lines to most of these situations. CLI errors use indented causal chains, not execution stack traces. error::format_error_chain prints each source() message unchanged; opaque dependency messages remain single entries. Ordinary error display also includes initialization causes; chain output may repeat causes already included in a wrapper's message. Runtime initialization caches share the original error. CLI --list retains distinct failures from all discovery probes.

Context creation

Symptom Cause and fix
Error::NoBackendAvailable { want_*, have_* } No backend can serve the hints. The reason includes runtime-loading and device-discovery failures; automatic selection still tries other backends. The have_* flags show which features the binary was built with; add --features onnx-runtime (or another backend) or relax the hints
Error::NoBackendAvailableForBackendHint The hinted backend is disabled, reports no matching device, or fails initialization. The reason distinguishes compile-time disabled support, naming the Cargo feature to enable, from runtime-loading or device-discovery failures. Check the backend-specific rows below
ONNX Runtime is unavailable, or initialization reports a missing library or incompatible version Set ORT_DYLIB_PATH to the downloaded ONNX Runtime 1.29 or newer shared library and restart the process. rustnn uses ort::init_from to return loading errors; backend discovery skips an unavailable runtime. An old onnxruntime.dll in Windows System32 can be selected if the variable is unset. See Getting Started
ONNX Runtime repeats the same initialization error after fixing ORT_DYLIB_PATH Initialization failures are cached for the process lifetime. Restart the process after fixing the library path
TensorRT-RTX not selected, log shows a library load error (LoadLibraryExW code 126 on Windows) tensorrt_rtx_1_6 is not on PATH / LD_LIBRARY_PATH; add the SDK library directory or call dynamically_load_tensorrt
CANN never selected By design; pass with_rustnn_backend_hint(Backend::Cann)
coreml is compile-time disabled on watchOS without the coreml-export feature watchOS has no Core ML model compiler. Build with coreml-export as well as coreml-runtime; graphs are then written by the pure-Rust exporter (Compile routes)

Building graphs

Symptom Cause and fix
GraphBuilderError::GraphAlreadyBuilt A builder compiles exactly one graph; create a new MLGraphBuilder for the next one
GraphBuilderError::WrongConstantSize The byte size of the slice does not match the descriptor; check the element count and the data type (4-bit types pack two values per byte)
GraphBuilderError::RequestedInputAsOutput / RequestedConstantAsOutput Outputs must be operation results; pass the result of identity if an input must be echoed
GraphBuilderError::AllowedDataTypes An input, option operand, or output violates the spec's type rules. The nested AllowedDataTypesError reports the operation, operand, allowed types, and used type; insert a cast or correct the descriptor. Packed 4-bit extensions use with_rustnn_allow_int4_uint4(true) on context options. The separate with_rustnn_bypass_allowed_data_types_checks(true) bypasses all type checks and emits warnings
AllowedDataTypesError::InconsistentConcatInput Concat inputs have different data types. The error identifies the zero-based input index and both types; cast inputs to a common type before concatenating
ShapeInferenceError::BroadcastError Input shapes are not broadcast-compatible; insert reshape or expand
GraphError::DynamicInputsFeatureDisabled The graph file declares a dynamic dimension; build with --features dynamic-inputs
Failed to convert graph: ... Unsupported operation: <name> The selected backend's converter has no lowering for that operation; see the operator support report and pick another backend or decompose the operation
Error::GraphBuildError from CoreML, LiteRT or TensorRT with a backend message The backend rejected the converted model. RUSTNN_ONNX_DUMP_DIR=<dir> dumps the ONNX model, TRTX_JSON_DUMP_PATH the TensorRT layers; run the WPT case for the operation (make test-wpt-op OP=<name>) to compare

Dispatch and tensors

Symptom Cause and fix
missing runtime input tensor `x` / unexpected runtime output tensor `y` The binding map lacks a name declared with MLGraphBuilder::input or in the outputs passed to build, or contains an extra one; names are the binding keys
runtime input tensor `x` rank mismatch / dimension 1 mismatch (expected 2, got 3) The tensor shape differs from the graph descriptor; for dynamic graphs call rustnn_resize_tensor before dispatch
dynamic dimension `seq` at axis 1 exceeds maxSize / runtime dynamic dimension `seq` mismatch The bound tensor is larger than the declared maxSize, or two tensors sharing a dimension name have different sizes
operand ... uses unsupported IO data type / Backend ... does not support data type The tensor or operand data type has no kernel on the selected backend; see the operator report and the relevant integration guide
Error::DuplicateTensorBinding One MLTensor appears under two names or as both input and output; use distinct tensors
Error::WrongWriteSize / WrongReadSize The host buffer must hold exactly tensor.rustnn_required_bytes() bytes
Error::WriteToNonWritableTensor / ReadToNonReadableTensor Create the tensor with to_writable() or to_readable()
Error::TensorCapacityError rustnn_set_tensor_capacity requested less storage than the active shape. Resize it first; rejection leaves shape and values unchanged on every backend
Wrong results after editing a converter (TensorRT) A cached engine from before the edit is unlikely (the cache key includes the converter sources) but possible for local uncommitted files; delete <cache_dir>/rustnn/trtx
CoreML build still compiles for seconds with compiled_bundle_cache set, or CoremlLoadDiagnostics::cache is Error(...) The outcome message names the step (publish failed, cached bundle rebuilt, cache unusable) and RUST_LOG=warn prints the cause; check that the directory is writable and has space. Disabled for a graph with inputs means the option was not set on this context. Deleting the directory or any <key> entry is safe; see Compiled-bundle cache

Tests and tooling

Symptom Cause and fix
WPT: No WPT backends available (exit code 2) A backend feature is compiled in but none of its runtimes could start; check the context-creation rows. Without any backend feature the harness exits successfully with a notice
WPT: no WPT conformance cases loaded or Node.js is required Install Node.js and run make fetch-wpt, or set WPT_DIR
WPT: warning that the checkout does not match WPT_REVISION Run make fetch-wpt; WPT_STRICT_REVISION=1 turns the warning into an error
insta reports a missing or changed snapshot A trial changed status; review the .snap.new files and run make wpt-sync-<backend> to regenerate baselines
make docs-api fails on flatc The rustdoc feature set includes litert-runtime; install flatc (see LiteRT) or build the docs without that feature
make docs-backend-ops-check fails A converter's operator support changed; run make docs-backend-ops and commit the report
CI job fails with detected conflict: 'bin/cargo-clippy' from rustup rustup was adding components from rust-toolchain.toml at the first cargo call; the workflows install them in the toolchain step, keep that when adding jobs
Windows: Access is denied from cargo fmt or the linker A test binary is still running; wait for it

ONNX Runtime environment already initialized

init_global_ort_env returns OrtAlreadyInitialized after an environment has been installed. Register EP libraries and supply the environment before listing devices or creating an ONNX context; an existing environment cannot be replaced.