Sanitary sewer overflow can occur due to blocked or broken sewer lines, infiltration of excessive stormwater or malfunction of pumps. In these cases untreated sewage is discharged from a sanitary sewer into the environment prior to reaching sewage treatment facilities. To avoid such overflows, maintenance is required. Blockage prevention campaigns or regulations (e.g. requiring the use of grease interceptors by some customers) may also be necessary.
The maintenance requirements vary with the type of sanitary sewer. In general, all sewers deteriorate with age, but infiltration and inflow are problems unique to sanitary sewers, since both combined sewers and storm drains are sized to carry these contributions. Holding infiltration to acceptable levels requires a higher standard of maintenance than necessary for structural integrity considerations of combined sewers.  A comprehensive construction inspection program is required to prevent inappropriate connection of cellar, yard, and roof drains to sanitary sewers. The probability of inappropriate connections is higher where combined sewers and sanitary sewers are found in close proximity, because construction personnel may not recognize the difference.  Many older cities still use combined sewers while adjacent suburbs were built with separate sanitary sewers.
For decades, when sanitary sewer pipes cracked or experienced other damage, the only option was an expensive excavation, removal and replacement of the damaged pipe, typically requiring street repavement afterwards.  In the mid-1950s a unit was invented where two units at each end with a special cement mixture in between was pulled from one manhole cover to the next, coating the pipe with the cement under high pressure, which then cured rapidly, sealing all cracks and breaks in the pipe. Today, a similar method using epoxy resin is used by some municipalities to re-line aging or damaged pipes, effectively creating a "pipe in a pipe". These methods may be unsuitable for locations where the full diameter of the original pipe is required to carry expected flows, and may be an unwise investment if greater wastewater flows may be anticipated from population growth, increased water use, or new service connections within the expected service life of the repair.
Another popular method for replacing aged or damaged lines is called pipe bursting, where a new pipe, typically PVC or ABS plastic, is drawn through the old pipe behind an "expander head" that breaks apart the old pipe as the new one is drawn through behind it.
These methods are most suitable for trunk sewers, since repair of lines with lateral connections is complicated by making provisions to receive lateral flows without accepting undesirable infiltration from inadequately sealed junctions.