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

Error 500 when saving a language profile #1924

Closed
sgezel opened this issue Aug 10, 2022 · 47 comments
Closed

Error 500 when saving a language profile #1924

sgezel opened this issue Aug 10, 2022 · 47 comments

Comments

@sgezel
Copy link

sgezel commented Aug 10, 2022

Describe the bug
I am getting an error 500 when adding a language profile

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'settings > languages'
  2. Add language englisth languages filter
  3. click on 'add new profile'
  4. click on 'add language'
  5. select english, enable HI
  6. click on the save button save
  7. scroll to the top and click on the save button
  8. See error
Exception on /api/system/settings [POST]:

Traceback (most recent call last):
  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 467, in wrapper
    resp = resource(*args, **kwargs)
  File "/opt/bazarr/bazarr/../libs/flask/views.py", line 84, in view
    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 582, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/opt/bazarr/bazarr/api/utils.py", line 30, in wrapper
    return actual_method(*args, **kwargs)
  File "/opt/bazarr/bazarr/api/system/settings.py", line 55, in post
    for item in json.loads(languages_profiles):
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

Software (please complete the following information):

  • Bazarr: v1.1.0
  • OS: Debian GNU/Linux 11 (bullseye)
@morpheus65535
Copy link
Owner

Try to disable your ads blocker.

@k-x7
Copy link

k-x7 commented Aug 13, 2022

I had the same issue, using private window (which disable ads blocker) solve it for me.

@morpheus65535
Copy link
Owner

No news, good news.

@Klithik
Copy link

Klithik commented Aug 23, 2022

worked like a charm, ty

@Joesilva
Copy link

Thank you guys! This worked for me too.

@GetoXs
Copy link

GetoXs commented Oct 16, 2022

FYI. The same issue appears in yesterday's version (1.1.2).
I need to downgrade to 1.1.1 and problem disappear.
Log from docker:

bazarr    | 2022-10-16 14:24:23,205 - app.app                          (7f1503454b38) :  ERROR (app:1457) - 
Exception on /api/system/settings [POST]

@morpheus65535
Copy link
Owner

morpheus65535 commented Oct 16, 2022

FYI. The same issue appears in yesterday's version (1.1.2).

Can you share the full exception trace?

Also, what browser (and version) do you use?

@GetoXs
Copy link

GetoXs commented Oct 16, 2022

Chrome, FF. Also in private mode.
Debug:

bazarr    | 2022-10-16 18:02:01,886 - peewee                           (7f0171827b38) :  DEBUG (peewee:3148) - ('SELECT "t1"."profileId" FROM 
"table_languages_profiles" AS "t1"', [])
bazarr    | 2022-10-16 18:02:01,898 - app.app                          (7f0171827b38) :  ERROR (app:1457) - Exception on /api/system/settings 
[POST]
bazarr    | Traceback (most recent call last):
bazarr    |   File "/app/bin/bazarr/../libs/flask/app.py", line 1516, in full_dispatch_request
bazarr    |     rv = self.dispatch_request()
bazarr    |   File "/app/bin/bazarr/../libs/flask/app.py", line 1502, in dispatch_request
bazarr    |     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
bazarr    |   File "/app/bin/bazarr/../libs/flask_restx/api.py", line 403, in wrapper
bazarr    |     resp = resource(*args, **kwargs)
bazarr    |   File "/app/bin/bazarr/../libs/flask/views.py", line 84, in view
bazarr    |     return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
bazarr    |   File "/app/bin/bazarr/../libs/flask_restx/resource.py", line 49, in dispatch_request
bazarr    |     resp = meth(*args, **kwargs)
bazarr    |   File "/app/bin/bazarr/api/utils.py", line 30, in wrapper
bazarr    |     return actual_method(*args, **kwargs)
bazarr    |   File "/app/bin/bazarr/api/system/settings.py", line 59, in post
bazarr    |     for item in json.loads(languages_profiles):
bazarr    |   File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
bazarr    |     return _default_decoder.decode(s)
bazarr    |   File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
bazarr    |     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
bazarr    |   File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
bazarr    |     raise JSONDecodeError("Expecting value", s, err.value) from None
bazarr    | json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

@morpheus65535
Copy link
Owner

@GetoXs are you accessing Bazarr through a reverse proxy?

@GetoXs
Copy link

GetoXs commented Oct 16, 2022

No, directly http://127.0.0.1:6767/

@morpheus65535
Copy link
Owner

@GetoXs can you provide the paylod from the request returning a 500 http error?

image

@GetoXs
Copy link

GetoXs commented Oct 17, 2022

Multipart:

------WebKitFormBoundary6jr4BAhBqbpuslwQ
Content-Disposition: form-data; name="settings-general-serie_default_enabled"

true
------WebKitFormBoundary6jr4BAhBqbpuslwQ
Content-Disposition: form-data; name="languages-profiles"

[object Object]
------WebKitFormBoundary6jr4BAhBqbpuslwQ
Content-Disposition: form-data; name="languages-profiles"

[object Object]
------WebKitFormBoundary6jr4BAhBqbpuslwQ--

FUll request

curl 'http://127.0.0.1:6767/api/system/settings' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'Accept-Language: pl-PL,pl;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary6jr4BAhBqbpuslwQ' \
  -H 'DNT: 1' \
  -H 'Origin: http://127.0.0.1:6767' \
  -H 'Pragma: no-cache' \
  -H 'Referer: http://127.0.0.1:6767/settings/languages' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36' \
  -H 'X-API-KEY: XXXXXXX' \
  -H 'sec-ch-ua: "Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  --data-raw $'------WebKitFormBoundary6jr4BAhBqbpuslwQ\r\nContent-Disposition: form-data; name="settings-general-serie_default_enabled"\r\n\r\ntrue\r\n------WebKitFormBoundary6jr4BAhBqbpuslwQ\r\nContent-Disposition: form-data; name="languages-profiles"\r\n\r\n[object Object]\r\n------WebKitFormBoundary6jr4BAhBqbpuslwQ\r\nContent-Disposition: form-data; name="languages-profiles"\r\n\r\n[object Object]\r\n------WebKitFormBoundary6jr4BAhBqbpuslwQ--\r\n' \
  --compressed

@GetoXs
Copy link

GetoXs commented Oct 17, 2022

The view I'm trying to save image

@morpheus65535
Copy link
Owner

@LASER-Yi any idea why the frontend try to send to backend JavaScript object instead of serialized JSON?

@morpheus65535
Copy link
Owner

Some users have reported that it works on mobile browser where all desktop browser failed.

@genera1z0d
Copy link

Some users have reported that it works on mobile browser where all desktop browser failed.

Just tried it on a mobile browser, per your suggestion, and can confirm it allowed me to create language profiles.

@bri2
Copy link

bri2 commented Oct 24, 2022

Some users have reported that it works on mobile browser where all desktop browser failed.

Can confirm this works on Firefox android 106.1.0, but not in Firefox windows 10 106.0.1

LASER-Yi added a commit that referenced this issue Oct 25, 2022
@LASER-Yi
Copy link
Collaborator

I submitted a fix which should fix this issue. Can you guys help me verify on your side? The fix should be available in the next upcoming beta version

@GetoXs
Copy link

GetoXs commented Oct 25, 2022

I can confirm it works.

@dglava
Copy link

dglava commented Oct 29, 2022

Do you mean v1.1.3-beta.9 or will there be another one? Because I can't see any relevant commits for this in beta.9. But I tested it just in case and the error is still there (same error above).

@jerryhopper
Copy link

Using development-version-v1.1.3-beta.11, the problem still exists.

The serialization of 'language-profiles' seems to be the culprit.

image

@rumplin
Copy link

rumplin commented Nov 10, 2022

using development 1.1.3-beta.15 the problem still exists.
Using incognito browsers Chrome, Edge and FireFox.

Traceback (most recent call last):
  File "/app/bazarr/bin/bazarr/../libs/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/app/bazarr/bin/bazarr/../libs/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/app/bazarr/bin/bazarr/../libs/flask_restx/api.py", line 405, in wrapper
    resp = resource(*args, **kwargs)
  File "/app/bazarr/bin/bazarr/../libs/flask/views.py", line 107, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/app/bazarr/bin/bazarr/../libs/flask_restx/resource.py", line 46, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/app/bazarr/bin/bazarr/api/utils.py", line 30, in wrapper
    return actual_method(*args, **kwargs)
  File "/app/bazarr/bin/bazarr/api/system/settings.py", line 59, in post
    for item in json.loads(languages_profiles):
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

image
image

@rumplin
Copy link

rumplin commented Nov 11, 2022

Can confirm that this is working when using a mobile device, not sure what the difference is but as a workaround, use your mobile devices.

@spider1163
Copy link

Similar error in "Movies blacklist" and still not working on mobile device

@morpheus65535
Copy link
Owner

Similar error in "Movies blacklist" and still not working on mobile device

That's a different issue already fixed in dev branch.

@gitpowershelluser
Copy link

Confirmed - just spent an hour resetting this up on my desktop. Odd bug :) I see it's already fixed in devbranch .. thanks!

@morpheus65535
Copy link
Owner

Someone with this issue can share a backup of Bazarr in PM over Discord?

@alpe12
Copy link

alpe12 commented Nov 20, 2022

Still not working. v1.1.3-beta.21

Someone with this issue can share a backup of Bazarr in PM over Discord?

Sended it.

@dglava
Copy link

dglava commented Nov 21, 2022

I have tested v1.1.3-beta.22 (which includes commit 3a82ccf) and am still getting what appears to be the same error.
I have tested it on Firefox 107 (Linux, package from the Arch repository).
I am not getting the error on my Android phone running Firefox.

My bad, I wrongly assumed that a fix has been pushed for this issue (it's a completely different issue).

If relevant: deleting a language profile also seems to fail silently (it reappears again after clicking "Save"). Here's the debug log:

Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,094 - socketio.server                  (7f21837fe700) :  INFO (server:310) - emitting event "data" to all [/]
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,095 - engineio.server                  (7f21837fe700) :  INFO (socket:89) - 6z1dkC2FSkB9hzY4AAAA: Sending packet MESSAGE data 2["data",{"type":"settings","action":"update","payload":null}]
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,295 - peewee                           (7f2181ffb700) :  DEBUG (peewee:3148) - ('SELECT COUNT(1) FROM (SELECT 1 FROM "table_episodes" AS "t1" INNER JOIN "table_shows" AS "t2" ON ("t1"."sonarrSeriesId" = "t2"."sonarrSeriesId") WHERE (("t1"."missing_subtitles" IS NOT ?) AND ("t1"."missing_subtitles" != ?))) AS "_wrapped"', [None, '[]'])
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,306 - peewee                           (7f21807f8700) :  DEBUG (peewee:3148) - ('SELECT "t1"."name", "t1"."enabled", "t1"."url" FROM "table_settings_notifier" AS "t1" ORDER BY "t1"."name"', [])
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,310 - peewee                           (7f2181ffb700) :  DEBUG (peewee:3148) - ('SELECT COUNT(1) FROM (SELECT 1 FROM "table_movies" AS "t1" WHERE (("t1"."missing_subtitles" IS NOT ?) AND ("t1"."missing_subtitles" != ?))) AS "_wrapped"', [None, '[]'])
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,317 - peewee                           (7f2181ffb700) :  DEBUG (peewee:3148) - ('SELECT "t1"."path", "t1"."accessible", "t1"."error" FROM "table_shows_rootfolder" AS "t1" WHERE ("t1"."accessible" = ?)', [0])
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,320 - peewee                           (7f2181ffb700) :  DEBUG (peewee:3148) - ('SELECT "t1"."path", "t1"."accessible", "t1"."error" FROM "table_movies_rootfolder" AS "t1" WHERE ("t1"."accessible" = ?)', [0])
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,349 - peewee                           (7f2180ff9700) :  DEBUG (peewee:3148) - ('SELECT "t1"."name", "t1"."code2", "t1"."enabled" FROM "table_settings_languages" AS "t1" ORDER BY "t1"."name"', [])
Nov 21 10:17:27 masina-s bazarr[88021]: 2022-11-21 10:17:27,357 - peewee                           (7f217fff7700) :  DEBUG (peewee:3148) - ('SELECT "t1"."profileId", "t1"."name", "t1"."cutoff", "t1"."items", "t1"."mustContain", "t1"."mustNotContain", "t1"."originalFormat" FROM "table_languages_profiles" AS "t1"', [])

@morpheus65535
Copy link
Owner

We are aware that this issue isn't fixed. Right now, we still can't reproduce it. We are unable to fix it without that so right now this issue is stalled.

@bri2
Copy link

bri2 commented Nov 27, 2022

It is fixed on my machines that had this problem (http500, [object Object] being sent) using the development branch with commit 30f04fe. I can add/remove/save language profiles again.
Thanks @LASER-Yi & @morpheus65535!

@dglava
Copy link

dglava commented Nov 28, 2022

Unfortunately I am still getting the same error using v1.1.3-beta.26. I tried turning off all addons, but without success.

@bri2
Copy link

bri2 commented Nov 28, 2022

Unfortunately I am still getting the same error using v1.1.3-beta.26. I tried turning off all addons, but without success.

Same here, v1.1.3-beta.26 does not work.
When downloading the development branch, running the server (bazarr.py) and using the client that the server serves on port 6767, it does not work (same problem as before, http500, [object Object] being sent). If I run a seperate instance of the development client (npm install, npm start, port 5173), it works.
It does not seem to be a browser caching problem, after clearing cache & using incognito window the problem persists.

Update: disregard my above message, I had set the update branch (bazarr -> general -> update) to 'master' causing the auto-updater to update to v1.1.2 (which contains the bug) on startup. Using 'development' as the branch (v1.1.3-beta26) works perfectly.

@alpe12
Copy link

alpe12 commented Nov 28, 2022

Docker v1.1.3-beta.26 fixed it for me.

@morpheus65535
Copy link
Owner

@dglava Unfortunately I am still getting the same error using v1.1.3-beta.26. I tried turning off all addons, but without success.

Did you try to empty cache? Not sure what else could be causing this issue.

@morpheus65535
Copy link
Owner

@sgezel can you test with 1.1.3-beta.26 and confirm if the issue is fixed for you?

@dglava
Copy link

dglava commented Nov 28, 2022

Did you try to empty cache? Not sure what else could be causing this issue.

Yes. I deleted my Bazarr configuration directory, reinstalled Bazarr, cleared my browser's cache, yet the error still persists. I connect to my Bazarr instance via a forwarded port via SSH. I tried accessing it via a reverse HTTP proxy, same issue.

Do you need other logs which could help with this?

Nov 28 22:15:30 masina-s bazarr[79113]: 2022-11-28 22:15:30,890 - peewee                           (7f4387ff7700) :  DEBUG (peewee:3148) - ('SELECT "t1"."profileId" FROM "table_languages_profiles" AS "t1"', [])
Nov 28 22:15:30 masina-s bazarr[79113]: 2022-11-28 22:15:30,896 - app.app                          (7f4387ff7700) :  ERROR (app:1457) - Exception on /bazarr/api/system/settings [POST]
Nov 28 22:15:30 masina-s bazarr[79113]: Traceback (most recent call last):
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/../libs/flask/app.py", line 1516, in full_dispatch_request
Nov 28 22:15:30 masina-s bazarr[79113]:     rv = self.dispatch_request()
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/../libs/flask/app.py", line 1502, in dispatch_request
Nov 28 22:15:30 masina-s bazarr[79113]:     return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/../libs/flask_restx/api.py", line 403, in wrapper
Nov 28 22:15:30 masina-s bazarr[79113]:     resp = resource(*args, **kwargs)
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/../libs/flask/views.py", line 84, in view
Nov 28 22:15:30 masina-s bazarr[79113]:     return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/../libs/flask_restx/resource.py", line 49, in dispatch_request
Nov 28 22:15:30 masina-s bazarr[79113]:     resp = meth(*args, **kwargs)
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/api/utils.py", line 30, in wrapper
Nov 28 22:15:30 masina-s bazarr[79113]:     return actual_method(*args, **kwargs)
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/bazarr/bazarr/api/system/settings.py", line 59, in post
Nov 28 22:15:30 masina-s bazarr[79113]:     for item in json.loads(languages_profiles):
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
Nov 28 22:15:30 masina-s bazarr[79113]:     return _default_decoder.decode(s)
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
Nov 28 22:15:30 masina-s bazarr[79113]:     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
Nov 28 22:15:30 masina-s bazarr[79113]:   File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
Nov 28 22:15:30 masina-s bazarr[79113]:     raise JSONDecodeError("Expecting value", s, err.value) from None
Nov 28 22:15:30 masina-s bazarr[79113]: json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

@morpheus65535
Copy link
Owner

I connect to my Bazarr instance via a forwarded port via SSH. I tried accessing it via a reverse HTTP proxy, same issue.

And if you simply access it directly?

@dglava
Copy link

dglava commented Nov 29, 2022

Still not working (accessing a Bazarr instance running on the same computer via Firefox on Linux). Are the people for whom it works now also using Firefox?

As before, it works on my smartphone's browser (Firefox Android).

@morpheus65535
Copy link
Owner

@dglava have you tried accessing it from another computer on the same network? Could it be related to some security suite on this specific computer?

@bri2
Copy link

bri2 commented Nov 29, 2022

Still not working (accessing a Bazarr instance running on the same computer via Firefox on Linux). Are the people for whom it works now also using Firefox?

As before, it works on my smartphone's browser (Firefox Android).

It's working for me using Firefox 107.0 on Windows 10 with v.1.1.3-beta26.
I made the mistake before of not changing the branch (bazarr -> general -> update) to 'development' causing it to revert to v.1.1.2 on launch. Is that setting the same for you? Also see system -> status -> bazarr version

@dglava
Copy link

dglava commented Nov 29, 2022

Oh wow, my bad. @bri2, you were right. It was automatically downgrading it to 1.1.2 despite downloading the beta release. I did see 1.1.2 under version, but I thought that the version string was just always stuck to the latest proper release. I guess I should use the --no-update flag for my packaged version.

I can confirm that the latest beta fixed this for me as well. Thank you.

@morpheus65535
Copy link
Owner

morpheus65535 commented Dec 5, 2022

Fixed in 1.1.3

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

No branches or pull requests