[GH-ISSUE #1122] [BUG] Translation uncaught exception #686

Closed
opened 2026-02-25 20:36:18 +03:00 by kerem · 4 comments
Owner

Originally created by @seirdotexe on GitHub (Feb 20, 2024).
Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/1122

Describe the bug
When a translatian isn't found, an uncaught exception is thrown.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1341, in handle_user_exception
    return self.handle_http_exception(e)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1281, in handle_http_exception
    return self.ensure_sync(handler)(e)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/whoogle/app/routes.py", line 609, in page_not_found
    return render_template('error.html', error_message=str(e)), 404
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 151, in render_template
    return _render(app, template, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 132, in _render
    rv = template.render(context)
         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/whoogle/app/templates/error.html", line 23, in top-level template code
    <h4><a class="link" href="https://farside.link">{{ translation['continue-search'] }}</a></h4>
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 466, in getitem
    return obj[argument]
           ~~~^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'translation' is undefined

To Reproduce
Steps to reproduce the behavior:

  1. Search anything

Deployment Method

  • Heroku (one-click deploy)
  • Docker
  • run executable
  • pip/pipx
  • Other: [describe setup]

Version of Whoogle Search

  • Latest build from Docker
  • Version [version number]
  • Not sure

Desktop (please complete the following information):

  • OS: Windows 11 x64
  • Browser: Firefox 123.0b9 (64-bit)

Additional context
Also reported in https://github.com/benbusby/whoogle-search/issues/1100#issuecomment-1871887923

Originally created by @seirdotexe on GitHub (Feb 20, 2024). Original GitHub issue: https://github.com/benbusby/whoogle-search/issues/1122 **Describe the bug** When a translatian isn't found, an uncaught exception is thrown. ``` Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1341, in handle_user_exception return self.handle_http_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1281, in handle_http_exception return self.ensure_sync(handler)(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/whoogle/app/routes.py", line 609, in page_not_found return render_template('error.html', error_message=str(e)), 404 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 151, in render_template return _render(app, template, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/templating.py", line 132, in _render rv = template.render(context) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/whoogle/app/templates/error.html", line 23, in top-level template code <h4><a class="link" href="https://farside.link">{{ translation['continue-search'] }}</a></h4> ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 466, in getitem return obj[argument] ~~~^^^^^^^^^^ jinja2.exceptions.UndefinedError: 'translation' is undefined ``` **To Reproduce** Steps to reproduce the behavior: 1. Search anything **Deployment Method** - [ ] Heroku (one-click deploy) - [x] Docker - [ ] `run` executable - [ ] pip/pipx - [ ] Other: [describe setup] **Version of Whoogle Search** - [x] Latest build from Docker - [ ] Version [version number] - [ ] Not sure **Desktop (please complete the following information):** - OS: Windows 11 x64 - Browser: Firefox 123.0b9 (64-bit) **Additional context** Also reported in https://github.com/benbusby/whoogle-search/issues/1100#issuecomment-1871887923
kerem 2026-02-25 20:36:18 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@varunpan commented on GitHub (Feb 23, 2024):

I am getting the same error from the latest version and casing my instance to crash.

<!-- gh-comment-id:1961557067 --> @varunpan commented on GitHub (Feb 23, 2024): I am getting the same error from the latest version and casing my instance to crash.
Author
Owner

@ahmad-alkadri commented on GitHub (Mar 2, 2024):

Found the same error when I clicked the "Dark Design: Deactivate" button at the bottom. Screen record:

screencast-localhost_5000-2024 03 02-08_57_49

Logs output at the end said the same thing:

jinja2.exceptions.UndefinedError: 'translation' is undefined

At a glance it looks like the error is from Jinja.

<!-- gh-comment-id:1974697605 --> @ahmad-alkadri commented on GitHub (Mar 2, 2024): Found the same error when I clicked the "Dark Design: Deactivate" button at the bottom. Screen record: ![screencast-localhost_5000-2024 03 02-08_57_49](https://github.com/benbusby/whoogle-search/assets/22837764/08931736-3fa4-44c5-8564-44f9fbd555f9) Logs output at the end said the same thing: ```python jinja2.exceptions.UndefinedError: 'translation' is undefined ``` At a glance it looks like the error is from Jinja.
Author
Owner

@ahmad-alkadri commented on GitHub (Mar 2, 2024):

Drafted a PR that seems to fix this (at least locally on my machines): #1126.

Would be happy to discuss.

<!-- gh-comment-id:1974747677 --> @ahmad-alkadri commented on GitHub (Mar 2, 2024): Drafted a PR that seems to fix this (at least locally on my machines): #1126. Would be happy to discuss.
Author
Owner

@seirdotexe commented on GitHub (Mar 2, 2024):

Drafted a PR that seems to fix this (at least locally on my machines): #1126.

Would be happy to discuss.

Looks great. Hopefully @benbusby can merge.

<!-- gh-comment-id:1974896808 --> @seirdotexe commented on GitHub (Mar 2, 2024): > Drafted a PR that seems to fix this (at least locally on my machines): #1126. > > Would be happy to discuss. Looks great. Hopefully @benbusby can merge.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/whoogle-search#686
No description provided.