The document “xyz.trace” could not be opened. Document Missing Template Error
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.
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.
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.
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.