Skip to content

[BUG] Can't start container after upgrade to 0.22.0 / 0.22.1 - "An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block." #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SylencerWebdesign opened this issue Apr 23, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@SylencerWebdesign
Copy link

SylencerWebdesign commented Apr 23, 2025

Describe the bug
Updated to the newst version

To Reproduce
Steps to reproduce the behavior: Update to 0.22.1

Expected behavior
Running like always after update.

Error logs
If you have any error logs, paste them here:

 Applying events.0009_fix_movie_episode_number...�      �Operations to perform:
  Apply all migrations: account, admin, app, auth, contenttypes, db, django_celery_beat, django_celery_results, events, lists, mfa, sessions, socialaccount, users
Running migrations:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 360, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.IntegrityError: UNIQUE constraint failed: events_event.item_id
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 255, in apply_migration
    state = migration.apply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.12/site-packages/django/db/migrations/operations/special.py", line 196, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/yamtrack/events/migrations/0009_fix_movie_episode_number.py", line 15, in fix_movie_events
    movie_events.update(episode_number=None)
  File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 1258, in update
    rows = query.get_compiler(self.db).execute_sql(ROW_COUNT)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 2059, in execute_sql
    row_count = super().execute_sql(result_type)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1622, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 100, in _execute
    with self.db.wrap_database_errors:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 360, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.IntegrityError: UNIQUE constraint failed: events_event.item_id
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/yamtrack/manage.py", line 27, in <module>
    main()
  File "/yamtrack/manage.py", line 23, in main
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 416, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 460, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 353, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    with self.connection.schema_editor(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/schema.py", line 39, in __exit__
    self.connection.check_constraints()
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/sqlite3/base.py", line 273, in check_constraints
    violations = cursor.execute("PRAGMA foreign_key_check").fetchall()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/utils.py", line 99, in _execute
    self.db.validate_no_broken_transaction()
  File "/usr/local/lib/python3.12/site-packages/django/db/backends/base/base.py", line 521, in validate_no_broken_transaction
    raise TransactionManagementError(
django.db.transaction.TransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.
  Applying events.0009_fix_movie_episode_number...

Yamtrack version:
Database: SQLite

Thank's for your work!

@FuzzyGrim
Copy link
Owner

FuzzyGrim commented Apr 23, 2025

Should be fixed with v0.22.3.

@driftywinds
Copy link

Should be fixed with v0.22.3.

I would like to reopen the issue because even though the container starts up and doesn't exit now, the logs show errors and the homepage looks like this -

Image

Logs are as follows: -

yamtrack        | [2025-04-23 22:26:45 +0530] [30] [ERROR] Internal Server Error: /
yamtrack        | Traceback (most recent call last):
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
yamtrack        |     response = get_response(request)
yamtrack        |                ^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
yamtrack        |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
yamtrack        |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/views/decorators/http.py", line 64, in inner
yamtrack        |     return func(request, *args, **kwargs)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/yamtrack/app/views.py", line 53, in home
yamtrack        |     return render(request, "app/home.html", context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/shortcuts.py", line 25, in render
yamtrack        |     content = loader.render_to_string(template_name, context, request, using=using)
yamtrack        |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/loader.py", line 62, in render_to_string
yamtrack        |     return template.render(context, request)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/backends/django.py", line 107, in render
yamtrack        |     return self.template.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 171, in render
yamtrack        |     return self._render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/test/utils.py", line 114, in instrumented_test_render
yamtrack        |     return self.nodelist.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
yamtrack        |     return SafeString("".join([node.render_annotated(context) for node in self]))
yamtrack        |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/loader_tags.py", line 159, in render
yamtrack        |     return compiled_parent._render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/test/utils.py", line 114, in instrumented_test_render
yamtrack        |     return self.nodelist.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
yamtrack        |     return SafeString("".join([node.render_annotated(context) for node in self]))
yamtrack        |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
yamtrack        |     result = block.nodelist.render(context)
yamtrack        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
yamtrack        |     return SafeString("".join([node.render_annotated(context) for node in self]))
yamtrack        |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/loader_tags.py", line 65, in render
yamtrack        |     result = block.nodelist.render(context)
yamtrack        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
yamtrack        |     return SafeString("".join([node.render_annotated(context) for node in self]))
yamtrack        |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/defaulttags.py", line 243, in render
yamtrack        |     nodelist.append(node.render_annotated(context))
yamtrack        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/loader_tags.py", line 210, in render
yamtrack        |     return template.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 173, in render
yamtrack        |     return self._render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/test/utils.py", line 114, in instrumented_test_render
yamtrack        |     return self.nodelist.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
yamtrack        |     return SafeString("".join([node.render_annotated(context) for node in self]))
yamtrack        |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/defaulttags.py", line 243, in render
yamtrack        |     nodelist.append(node.render_annotated(context))
yamtrack        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/defaulttags.py", line 327, in render
yamtrack        |     return nodelist.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1016, in render
yamtrack        |     return SafeString("".join([node.render_annotated(context) for node in self]))
yamtrack        |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 977, in render_annotated
yamtrack        |     return self.render(context)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 1075, in render
yamtrack        |     output = self.filter_expression.resolve(context)
yamtrack        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/usr/local/lib/python3.12/site-packages/django/template/base.py", line 749, in resolve
yamtrack        |     new_obj = func(obj, *arg_vals)
yamtrack        |               ^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/yamtrack/app/templatetags/app_tags.py", line 108, in short_unit
yamtrack        |     return media_type_config.get_unit(media_type, short=True)
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/yamtrack/app/media_type_config.py", line 202, in get_unit
yamtrack        |     unit = get_property(media_type, "unit")
yamtrack        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
yamtrack        |   File "/yamtrack/app/media_type_config.py", line 144, in get_property
yamtrack        |     raise KeyError(msg) from None
yamtrack        | KeyError: "Property 'unit' not found for media type 'movie'."

@FuzzyGrim FuzzyGrim reopened this Apr 23, 2025
@FuzzyGrim
Copy link
Owner

Released v0.22.4

@elsherif896
Copy link

thank you for your work v0.22.4 has done it for me

@driftywinds
Copy link

driftywinds commented Apr 23, 2025

its working for me too!
Just a heads up, I realised there is no way to see the version of the app in the web UI itself, if you could implement that in an about section near settings or something it would be very helpful!
Should I make this a separate feature request?

@FuzzyGrim
Copy link
Owner

Just a heads up, I realised there is no way to see the version of the app in the web UI itself, if you could implement that in an about section near settings or something it would be very helpful!
Should I make this a separate feature request?

Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants