A dependable software system must contain two dependability components: (i) error detection mechanisms (EDMs) and (ii) error recovery mechanisms (ERMs). Currently, EDMs are generally designed based on some system specification or based on the experience of software engineers, with their efficiency typically being measured using fault injection and software measures such as coverage and latency. In contrast to finite-state programs, for which efficient EDMs can be obtained by design, no systematic design approach exists for real-world software systems. In this paper, we bridge this gap by developing an approach for the design of highly efficient error detection predicates for EDMs for such software systems. Our approach is based on the use of data mining techniques to classify states as safe or failure-inducing. The results presented, under a transient data value fault model, demonstrate the viability of the approach for the development of efficient EDMs, as the EDMs generated yield a true positive rate of nearly 100% and a false positive rate close to 0% for the detection of failure-inducing states.