1. A computer implemented method for automatically patching errors in a software system that includes a first software component and a second software component including a set of interfaces, the method comprising: monitoring a first set of executions of the software system including: monitoring a plurality of error-free interactions between the first software component and the set of interfaces of the second software component; identifying invariants from the plurality of error-free interactions, each invariant being associated with one or more contexts; forming a data structure including an association of each interface in the set of interfaces with invariants associated with that interface; and monitoring a second set of executions of the software system including: accepting the formed data structure; for each interaction of a plurality of interactions between the first software component and the set of interfaces of the second software component in a second set of executions: using the data structure to determine whether the interaction between the first software component and an interface of the set of interfaces violates any invariants associated with the interface and their associated contexts; and initiating an error control procedure including performing a known behavior in response to the interaction if it is determined that the interaction violates any invariants associated with the interface and their associated contexts.