Error 500 Internal Server error

Hi Kyle

Hope everything is going well.

I have updated my Mycodo software today to v8.12.7

Everything is working, but I can’t access anything on the browser as the page is stuck on the folowing:

Error 500: Internal Server Error
Something bad happened but it’s probably not your fault. Letting the developers know about these issues is crucial to supporting Mycodo. Please submit a new issue on GitHub with the following diagnostic information and error traceback (copy the entire traceback):

Version: 8.12.7
Database: 0187ea22dc4b
Model: Raspberry Pi 2 Model B Rev 1.1

Release:
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster

Firmware:
May 27 2021 14:04:13
Copyright (c) 2012 Broadcom
version 7d9a298cda813f747b51fe17e1e417e7bf5ca94d (clean) (release) (start)

Error (Full Traceback):

Traceback (most recent call last):

  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1800, in _execute_context*
  • cursor, statement, parameters, context*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/default.py”, line 717, in do_execute*
  • cursor.execute(statement, parameters)*
    sqlite3.OperationalError: no such column: camera.timelapse_last_file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py”, line 2073, in wsgi_app*
  • response = self.full_dispatch_request()*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py”, line 1518, in full_dispatch_request*
  • rv = self.handle_user_exception(e)*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/flask_restx/api.py”, line 672, in error_router*
  • return original_handler(e)*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py”, line 1516, in full_dispatch_request*
  • rv = self.dispatch_request()*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/flask/app.py”, line 1502, in dispatch_request*
  • return self.ensure_sync(self.view_functions[rule.endpoint])(*req.view_args)
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/flask_login/utils.py”, line 272, in decorated_view*
  • return func(*args, *kwargs)
  • File “/home/pi/Mycodo/mycodo/mycodo_flask/routes_dashboard.py”, line 105, in page_dashboard*
  • camera = Camera.query.all()*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/orm/query.py”, line 2711, in all*
  • return self._iter().all()*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/orm/query.py”, line 2849, in _iter*
  • execution_options={"_sa_orm_load_options": self.load_options},*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/orm/session.py”, line 1689, in execute*
  • result = conn._execute_20(statement, params or {}, execution_options)*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1611, in _execute_20*
  • return meth(self, args_10style, kwargs_10style, execution_options)*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/sql/elements.py”, line 324, in _execute_on_connection*
  • self, multiparams, params, execution_options*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1488, in _execute_clauseelement*
  • cache_hit=cache_hit,*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1843, in _execute_context*
  • e, statement, parameters, cursor, context*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 2024, in _handle_dbapi_exception*
  • sqlalchemy_exception, with_traceback=exc_info[2], from_=e*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/util/compat.py”, line 207, in raise_*
  • raise exception*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/base.py”, line 1800, in _execute_context*
  • cursor, statement, parameters, context*
  • File “/home/pi/Mycodo/env/lib/python3.7/site-packages/sqlalchemy/engine/default.py”, line 717, in do_execute*
  • cursor.execute(statement, parameters)*
    sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: camera.timelapse_last_file
    *[SQL: SELECT camera.id AS camera_id, camera.unique_id AS camera_unique_id, camera.name AS camera_name, camera.library AS camera_library, camera.device AS camera_device, camera.opencv_device AS camera_opencv_device, camera.hflip AS camera_hflip, camera.vflip AS camera_vflip, camera.rotation AS camera_rotation, camera.brightness AS camera_brightness, camera.contrast AS camera_contrast, camera.exposure AS camera_exposure, camera.gain AS camera_gain, camera.hue AS camera_hue, camera.saturation AS camera_saturation, camera.white_balance AS camera_white_balance, camera.custom_options AS camera_custom_options, camera.output_id AS camera_output_id, camera.output_duration AS camera_output_duration, camera.cmd_pre_camera AS camera_cmd_pre_camera, camera.cmd_post_camera AS camera_cmd_post_camera, camera.stream_started AS camera_stream_started, camera.hide_still AS camera_hide_still, camera.hide_timelapse AS camera_hide_timelapse, camera.url_still AS camera_url_still, camera.url_stream AS camera_url_stream, camera.timelapse_started AS camera_timelapse_started, camera.timelapse_paused AS camera_timelapse_paused, camera.timelapse_start_time AS camera_timelapse_start_time, camera.timelapse_end_time AS camera_timelapse_end_time, camera.timelapse_interval AS camera_timelapse_interval, camera.timelapse_next_capture AS camera_timelapse_next_capture, camera.timelapse_capture_number AS camera_timelapse_capture_number, camera.timelapse_last_file AS camera_timelapse_last_file, camera.timelapse_last_ts AS camera_timelapse_last_ts, camera.still_last_file AS camera_still_last_file, camera.still_last_ts AS camera_still_last_ts, camera.path_still AS camera_path_still, camera.path_timelapse AS camera_path_timelapse, camera.path_video AS camera_path_video, camera.width AS camera_width, camera.height AS camera_height, camera.resolution_stream_width AS camera_resolution_stream_width, camera.resolution_stream_height AS camera_resolution_stream_height, camera.stream_fps AS camera_stream_fps, camera.picamera_shutter_speed AS camera_picamera_shutter_speed, camera.picamera_sharpness AS camera_picamera_sharpness, camera.picamera_iso AS camera_picamera_iso, camera.picamera_awb AS camera_picamera_awb, camera.picamera_awb_gain_red AS camera_picamera_awb_gain_red, camera.picamera_awb_gain_blue AS camera_picamera_awb_gain_blue, camera.picamera_exposure_mode AS camera_picamera_exposure_mode, camera.picamera_meter_mode AS camera_picamera_meter_mode, camera.picamera_image_effect AS camera_picamera_image_effect *
    FROM camera]
    (Background on this error at: Error Messages — SQLAlchemy 1.4 Documentation)

I have looked at the webpage for the error, but can’t find the answer there.

Any help would be much appreciated
Regards
Pieter

Your database didn’t properly update during the upgrade. You can inspect the upgrade log at /var/log/mycodo/mycodoupgrade.log. I recommend manually downgrading and attempting the upgrade again.

Find your last backup in:

ls /var/Mycodo-backups

Then restore the backup with the following, replacing with the correct directory:

sudo mycodo-commands backup-restore /var/Mycodo-backups/RESTORE_DIRECTORY/

Kyle

Many thanks for your assistance, I have restored the database to the previous version.

I will attempt the upgrade at a later stage.

Pieter

1 Like