cargo-instruments icon indicating copy to clipboard operation
cargo-instruments copied to clipboard

The document “xyz.trace” could not be opened. Document Missing Template Error

Open drazen-todorovic opened this issue 2 years ago • 3 comments

The command

open target/instruments/xyz.trace

Causes the following error: "The document “xyz.trace” could not be opened. Document Missing Template Error".

I am running the cargo instruments with the following command:

cargo instruments --package backend --template alloc --bin backend --release

Debug info for the release profile is enabled.

Os version: macOS Sonoma 14.0 Chip: Apple M2

Latest XCode tools installed.

drazen-todorovic avatar Oct 18 '23 10:10 drazen-todorovic

I'm also getting this locally, and when I try to drop my trace into https://www.speedscope.app, it produces a similar error: Failed to load format Error: Expected key form.template.

sondrelg avatar Sep 01 '24 05:09 sondrelg

I am not sure if it helps anyone, I also encountered this issue and figured out it was because I was killing the process before it was done. My application is a server that is long running and will stop gracefully on on Ctrl+C or SIGHUP.
I was running cargo instruments --template alloc, waiting for a while and then killing it with Ctrl+C. Moving to cargo instruments --template alloc --time-limit 30000 solved this problem.

arielpeltz avatar Sep 11 '24 10:09 arielpeltz

Thank you @arielpeltz for the --time-limit hint. I was also using Ctrl-C to stop the profiling and then was unable to open the trace with Instruments.app. Using the --time-limit solved the problem.

turingbuilder avatar Aug 24 '25 19:08 turingbuilder