Skip to content
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

django.utils.encoding.DjangoUnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 2: invalid start byte. #714

Open
Lomank123 opened this issue Jun 10, 2024 · 0 comments

Comments

@Lomank123
Copy link

Error occurred during changing and saving user model fields in db.

Python version: 3.11.9
django-silk version: 5.1.0
Django version: 4.2.13

Field types that were changed:

  • models.CharField
  • models.BooleanField

Docker container logs:

container  | ERROR 2024-06-06 11:59:04,309 mutation.py mutate_and_get_payload:
container  | 'utf-8' codec can't decode byte 0x8b in position 2: invalid start byte. You passed in b'\x18\\\x8b\xce\x84\xac\xf0\r\xe4D;\xe70\x04\xb9\xa0\xf3H\xcd"\xe4$\x1d\xf13\xb1PA=\xa3@\xa4\xdc\xe6\x91\x08^\x84v\r\\\xe1\xf1\xfa,\x1a\x89\xc5a7m\xc16\xfbu+\xe22C\x81/\x89\x8dI=!\x16\xc0\xdb0\xba\x12\xe0\xb8\\j\x10c\xcf\xefu\xbb\x91\x91\x8b\x8c\x08\xe6s%\xd0\x11\xfb[G\xa2\x8dHB\x18\x16\x9a\xf8\xb1\x05\xf6@\xd4\x93I\xc6\r' (<class 'bytes'>)
container  | Traceback (most recent call last):
container  |   File "/home/.local/lib/python3.11/site-packages/django/utils/encoding.py", line 70, in force_str
container  |     s = str(s, encoding, errors)
container  |         ^^^^^^^^^^^^^^^^^^^^^^^^
container  | UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 2: invalid start byte
container  | 
container  | During handling of the above exception, another exception occurred:
container  | 
container  | Traceback (most recent call last):
container  |   File "/app/app/graphql/mutations/mutation.py", line 54, in mutate_and_get_payload
container  |     user.save()
container  |   File "/home/.local/lib/python3.11/site-packages/django/contrib/auth/base_user.py", line 76, in save
container  |     super().save(*args, **kwargs)
container  |   File "/home/.local/lib/python3.11/site-packages/django/db/models/base.py", line 814, in save
container  |     self.save_base(
container  |   File "/home/.local/lib/python3.11/site-packages/django/db/models/base.py", line 877, in save_base
container  |     updated = self._save_table(
container  |               ^^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/django/db/models/base.py", line 990, in _save_table
container  |     updated = self._do_update(
container  |               ^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/django/db/models/base.py", line 1054, in _do_update
container  |     return filtered._update(values) > 0
container  |            ^^^^^^^^^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/django/db/models/query.py", line 1231, in _update
container  |     return query.get_compiler(self.db).execute_sql(CURSOR)
container  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1984, in execute_sql
container  |     cursor = super().execute_sql(result_type)
container  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/silk/sql.py", line 80, in execute_sql
container  |     sql_query = q % tuple(force_str(param) for param in params)
container  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/silk/sql.py", line 80, in <genexpr>
container  |     sql_query = q % tuple(force_str(param) for param in params)
container  |                           ^^^^^^^^^^^^^^^^
container  |   File "/home/.local/lib/python3.11/site-packages/django/utils/encoding.py", line 74, in force_str
container  |     raise DjangoUnicodeDecodeError(s, *e.args)
container  | django.utils.encoding.DjangoUnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 2: invalid start byte. You passed in b'\x18\\\x8b\xce\x84\xac\xf0\r\xe4D;\xe70\x04\xb9\xa0\xf3H\xcd"\xe4$\x1d\xf13\xb1PA=\xa3@\xa4\xdc\xe6\x91\x08^\x84v\r\\\xe1\xf1\xfa,\x1a\x89\xc5a7m\xc16\xfbu+\xe22C\x81/\x89\x8dI=!\x16\xc0\xdb0\xba\x12\xe0\xb8\\j\x10c\xcf\xefu\xbb\x91\x91\x8b\x8c\x08\xe6s%\xd0\x11\xfb[G\xa2\x8dHB\x18\x16\x9a\xf8\xb1\x05\xf6@\xd4\x93I\xc6\r' (<class 'bytes'>)

If some additional info is required, please let me know. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant