The problems of error detection and recovery are examined in a number of concurrent processes expressed as a set of communicating sequential processes (CSP). A method is proposed which uses a Petri net model to formally identify both the state and the state reachability tree of a distributed system. These are used to define systematically the boundaries of a conversation, including the recovery and test lines which are essential parts of the fault-tolerant mechanism. The techniques are implemented using the OCCAM programming language, which is derived from CSP. The application of this method is shown by a control example.