In this paper we consider a queueing system M/M/1 with non-reliable server. When the server is in normal state, the service error (or failure) occurs according to a Poisson process. In the error state the server requires to be repaired at a repair facility with exponential repair time but according to the threshold policy it can be done only if the number of customers in the system reaches some prespecified threshold level q ≥ 1. We perform a steady-state analysis of the corresponding continuous-time Markov chain and calculate optimal threshold level to minimize the long-run average losses given cost structure.