One of the most important skills when working with others - whether it be in a team, between teams, or between businesses and clients - is knowing how to manage expectations.
To put it simply, managing expectations is ensuring that your own expectations are in alignment with the expectations of others. Conflict between parties arise when expectations are not managed.
For example, while working on a project for a client that was planned to be completed in four weeks, you come across an issue that will extend that timeline by two weeks.
To best manage expectations in this case, it is best to get the bad news out as soon as possible, even if this may not initially feel good. Before the project was even started, it may have been better to provide a longer timeline that would have accounted for potential issues, even if this seems longer than what was expected initially.
In general, it is better to under-promise and over-deliver, than to do the inverse. Bad news should be delivered as soon as possible - ideally with potential solutions. This increases the chances of expectations being managed in a way that ensure everyone remains happy when a project is completed.