NextCloud “Maintenance” Mode Error Resolution

For a while my NextCloud server decided to stop allowing my phone or desktop to upload to it due to it being in “maintenance mode”, however I could log into the webui with no problems, and nothing in the logs showed it being in maintenance mode. This started to frustrate me as I could find nothing to signify why my clients thought the server couldn’t be used. I tried a number of things:

  • Clearing out the file locks table (there were 600,000 entries in it, and I’m the only user on the server)
  • occ db:add-missing-columns
  • occ db:add-missing-indices
  • occ db:add-missing-primary-keys
    What finally worked:
  • occ files:scan –all

Finally with the files:scan –all it started working again and my app was able to start uploading to the server. If you have a NextCloud server and have been running into “maintenance mode” errors when your server is not in maintenance mode, this is certainly worth trying.

Some GitHub Issues worth checking: