tracel-ai/burn · error
Can read the data without error
Error message
Can read the data without error
What it means
This panic occurs in bool_argwhere after awaiting B::bool_into_data(tensor), which materializes a boolean tensor's data on the host to count nonzero elements for the argwhere (indices of true values) operation. The expect fires if the backend's data-read future returns an error — i.e. the tensor data could not be transferred/computed into a readable Data struct.
Source
Thrown at crates/burn-backend/src/backend/ops/bool_tensor.rs:579
///
/// * `tensor` - The input tensor.
/// * `out_dtype` - The output tensor dtype.
///
/// # Returns
///
/// A 2D tensor containing the indices of all non-zero elements of the given tensor.
/// Each row contains the indices of a non-zero element.
fn bool_argwhere(
tensor: BoolTensor<B>,
out_dtype: IntDType,
) -> impl Future<Output = IntTensor<B>> + 'static + Send {
async move {
// Size of each output tensor is variable (= number of nonzero elements in the tensor).
// Reading the data to count the number of truth values might cause sync but is required.
let device = &tensor.device();
let data = B::bool_into_data(tensor)
.await
.expect("Can read the data without error");
argwhere_data::<B>(data, device, out_dtype)
}
}
/// Broadcasts the bool `tensor` to the given `shape`.
fn bool_expand(tensor: BoolTensor<B>, shape: Shape) -> BoolTensor<B>;
/// Unfold windows along a dimension.
///
/// Returns a view of the tensor with all complete windows of size `size` in dimension `dim`;
/// where windows are advanced by `step` at each index.
///
/// The number of windows is `0` when `shape[dim] < size`, and otherwise
/// `(shape[dim] - size) / step + 1`.
///
/// # Arguments
///
/// * `tensor` - The input tensor to unfold; of shape ``[pre=..., dim shape, post=...]``View on GitHub (pinned to d16f7ba2ed)
Solutions
- Check the tensor's device is reachable and healthy before argwhere (device logs, connection state for remote backends).
- Verify the tensor handle is still valid — not consumed or dropped elsewhere in the graph.
- Look for a root-cause backend error (CUDA OOM, driver reset) reported before this expect fires.
- For remote/communication backends, re-establish the peer connection and retry the operation.
Example fix
// before
let data = B::bool_into_data(tensor).await.expect("Can read the data without error");
// after
let data = B::bool_into_data(tensor).await
.context("failed to read bool tensor data in argwhere; check device health")?; Defensive patterns
Strategy: try-catch
Try / catch
let data = B::bool_into_data(tensor).await
.map_err(|e| anyhow::anyhow!("argwhere: bool_into_data failed: {e}"))?; Prevention
- Confirm the tensor device is healthy and connected before data reads.
- Avoid reusing tensor handles after ownership transfer into other ops.
- Watch GPU memory/driver logs; OOM often surfaces at into_data.
When it happens
Trigger: The underlying backend read fails during bool_into_data — e.g. the tensor handle is invalid (freed or created on a device that errored), a backend kernel fails during the async read, or a remote/communication-backed backend loses its peer connection mid-transfer.
Common situations: Calling argwhere on a tensor whose device connection dropped (distributed/WebSocket tensor transfer failed); using a tensor that was already consumed/freed by another op; GPU driver or OOM errors surfacing through the into_data read.
Related errors
- Expected float handle, got {}
- Expected int handle, got {}
- Expected bool handle, got {}
- Expected quantized handle, got {}
- float_storage_as_f32: unsupported dtype {:?}
AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05).
Data as JSON: /api/errors/905c86eb81c5d95b.
Report an issue: GitHub.