tracel-ai/burn · error

capture graph {graph_id:?} was not registered

Error message

capture graph {graph_id:?} was not registered

What it means

Replaying/attaching a graph by id requires that the graph was previously recorded and stored in the capture client's state. Looking up `graphs[graph_id]` fails when the id is unknown, indicating the graph was never registered or its state was already consumed/dropped.

Source

Thrown at crates/burn-capture/src/capture.rs:565

        bindings: GraphBindings,
    ) {
        let graph = Graph::new(relative_graph);
        let bound = graph.bind(bindings);
        let mut state = self.state().lock();
        state.graphs.insert(graph_id, graph);
        for operation in bound.operations {
            state.register_op(operation);
        }
    }

    fn execute_graph(&self, graph_id: GraphId, bindings: GraphBindings) {
        let graph = self
            .state()
            .lock()
            .graphs
            .get(&graph_id)
            .cloned()
            .unwrap_or_else(|| panic!("capture graph {graph_id:?} was not registered"));
        let bound = graph.bind(bindings);
        let mut state = self.state().lock();
        for operation in bound.operations {
            state.register_op(operation);
        }
    }

    fn register_alias(&self, new_id: TensorId, src_id: TensorId) {
        let mut state = self.state().lock();
        state.assert_open();
        let source = state.resolve_alias(src_id);
        if source != new_id {
            state.aliases.insert(new_id, source);
        }
    }
}

#[cfg(test)]

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Register the graph first (record it in a capture scope) before referencing its id.
  2. Confirm the graph_id comes from the same capture client/session you are replaying on.
  3. Check for state resets or client recreation between recording and replay; re-record if needed.

Example fix

// before
client.bind_graph(GraphId(7), bindings); // never recorded in this client
// after
let graph_id = device.capture_scope(|device| {
    // build ops, record graph
    recorded_graph_id
});
client.bind_graph(graph_id, bindings);
Defensive patterns

Strategy: validation

Validate before calling

// Record the graph first, keep the returned id, then bind
let graph_id = device.capture_scope(|_d| { /* record */ recorded_graph_id });
assert!(state_has_graph(&client, &graph_id), "graph must be registered before binding");

Prevention

When it happens

Trigger: Calling the operation-bind/replay API with a `graph_id` that was never produced by a capture run; reusing a graph id after the capture state was reset; a typo/stale id from a previous process or session.

Common situations: Replaying recorded graphs in a new client instance without re-recording; caching graph ids across capture sessions; concurrent capture runs where one scope's ids are used in another.

Related errors


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/7c021489135ae605. Report an issue: GitHub.