Incidents are part of the Software’s lifecycle.
You won’t be able to fully avoid them, but when they happen there must be a good process in place.
The process should include: - reporting and resolving the incident, - writing detailed documentation and - conducting a retrospective.
The latter is particularly important so the whole team understands the issues that have occurred and collectively find solutions to avoid them in the future.