Revert "Revert "fix trace error usage""

See #6206
See #6353

This reverts commit 82f01766564b359fc1eda13ef0ad51b1d783ee00.