Star Trek the Next Generation episode 'Up the Long Ladder', shows a MAJOR problem.
Riker, mentioned automated maintenance...
Keeping a starship clean, is only the beginning.
Carpet gets too worn? Beam the section of carpet, and beam a new section in. This is second level maintenance.
Corridor paint and dented? Beam out the old, and replace. This also is level two.
Outer hull section battered? More than ten square meters? Beam off the old, and replace. Level three due to the size.
Outer and inner hulls penetrated? Level three, unless greater than ten cubic meters are needed to be replaced.
Level four - warp nacelle(s) out of alignment? Major hull sections require replacement...
Level five.
More than twenty-five percent of ship needing replacement?
All of these require enough power and fuel to do.
In Star Trek: Discovery, entire hull sections could slide into place by spring loaded events, with temporary welds...