General solution of the consistency equation