Merge "diag: Fix writing of error message for mode command"