Repository navigation
[SQL Lab] Cannot perform any query when change language #27367
Copy link
Copy link
Closed
Description
Bug description
I'm using version 3.1.1
When I have superset configured in English, I can load tables, preview, and execute SQL without problems
When I switch to Portuguese language, I start getting not enough arguments for format string error in preview or any sql execution
|
|
Log
2024-03-02 00:39:11 Query 75: Executing 1 statement(s)
2024-03-02 00:39:11 2024-03-02 08:39:11,948:INFO:superset.sql_lab:Query 75: Executing 1 statement(s)
2024-03-02 00:39:11 Query 75: Set query to 'running'
2024-03-02 00:39:11 2024-03-02 08:39:11,948:INFO:superset.sql_lab:Query 75: Set query to 'running'
2024-03-02 00:39:12 SupersetErrorsException
2024-03-02 00:39:12 Traceback (most recent call last):
2024-03-02 00:39:12 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
2024-03-02 00:39:12 rv = self.dispatch_request()
2024-03-02 00:39:12 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
2024-03-02 00:39:12 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
2024-03-02 00:39:12 return f(self, *args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/views/base_api.py", line 127, in wraps
2024-03-02 00:39:12 raise ex
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/views/base_api.py", line 121, in wraps
2024-03-02 00:39:12 duration, response = time_function(f, self, *args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/utils/core.py", line 1463, in time_function
2024-03-02 00:39:12 response = func(*args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/views/base_api.py", line 93, in wraps
2024-03-02 00:39:12 return f(self, *args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/utils/log.py", line 255, in wrapper
2024-03-02 00:39:12 value = f(*args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/sqllab/api.py", line 407, in execute_sql_query
2024-03-02 00:39:12 command_result: CommandResult = command.run()
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 121, in run
2024-03-02 00:39:12 raise ex
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 103, in run
2024-03-02 00:39:12 status = self._run_sql_json_exec_from_scratch()
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 161, in _run_sql_json_exec_from_scratch
2024-03-02 00:39:12 raise ex
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 156, in _run_sql_json_exec_from_scratch
2024-03-02 00:39:12 return self._sql_json_executor.execute(
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/sqllab/sql_json_executer.py", line 111, in execute
2024-03-02 00:39:12 raise SupersetErrorsException(
2024-03-02 00:39:12 superset.exceptions.SupersetErrorsException: [SupersetError(message='not enough arguments for format string', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'PostgreSQL', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - O banco de dados retornou um erro inesperado.'}]})]
2024-03-02 00:39:12 2024-03-02 08:39:12,063:WARNING:superset.views.base:SupersetErrorsException
2024-03-02 00:39:12 Traceback (most recent call last):
2024-03-02 00:39:12 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1823, in full_dispatch_request
2024-03-02 00:39:12 rv = self.dispatch_request()
2024-03-02 00:39:12 File "/usr/local/lib/python3.9/site-packages/flask/app.py", line 1799, in dispatch_request
2024-03-02 00:39:12 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
2024-03-02 00:39:12 return f(self, *args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/views/base_api.py", line 127, in wraps
2024-03-02 00:39:12 raise ex
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/views/base_api.py", line 121, in wraps
2024-03-02 00:39:12 duration, response = time_function(f, self, *args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/utils/core.py", line 1463, in time_function
2024-03-02 00:39:12 response = func(*args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/views/base_api.py", line 93, in wraps
2024-03-02 00:39:12 return f(self, *args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/utils/log.py", line 255, in wrapper
2024-03-02 00:39:12 value = f(*args, **kwargs)
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/sqllab/api.py", line 407, in execute_sql_query
2024-03-02 00:39:12 command_result: CommandResult = command.run()
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 121, in run
2024-03-02 00:39:12 raise ex
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 103, in run
2024-03-02 00:39:12 status = self._run_sql_json_exec_from_scratch()
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 161, in _run_sql_json_exec_from_scratch
2024-03-02 00:39:12 raise ex
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/commands/sql_lab/execute.py", line 156, in _run_sql_json_exec_from_scratch
2024-03-02 00:39:12 return self._sql_json_executor.execute(
2024-03-02 00:39:12 File "/app/superset_home/.local/lib/python3.9/site-packages/superset/sqllab/sql_json_executer.py", line 111, in execute
2024-03-02 00:39:12 raise SupersetErrorsException(
2024-03-02 00:39:12 superset.exceptions.SupersetErrorsException: [SupersetError(message='not enough arguments for format string', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'PostgreSQL', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - O banco de dados retornou um erro inesperado.'}]})]How to reproduce the bug
- Go to SQL Lab
- Make sure you can preview or execute SQL statement
- Change Language, I used Portuguese BR
- Reload page
- Neither preview or SQL execution works
Screenshots/recordings
No response
Superset version
3.1.1
Python version
3.9
Node version
I don't know
Browser
Firefox
Additional context
No response
Checklist
- I have searched Superset docs and Slack and didn't find a solution to my problem.
- I have searched the GitHub issue tracker and didn't find a similar bug report.
- I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels




Activity
davidkestering commentedon Apr 21, 2024
The same issue happens with me too! I am running version 4.0.0
desennalin commentedon Jul 3, 2024
Same problem here in version 4, I had to switch back to English, do you want anything?
rusackas commentedon Jul 3, 2024
@dosu-bot
dosubot commentedon Jul 3, 2024
Hello, @rusackas! I'm here to help you with any issues you may have while waiting for a human maintainer. I can help you solve bugs, answer questions, and become a contributor. Let me know how I can assist you!
To resolve the "not enough arguments for format string" error in Apache Superset when switching the language to Portuguese (BR) and attempting to preview or execute SQL statements, you need to ensure that the translation strings in the
messages.pofile correctly match the placeholders used in the original English strings.For example, there is a mismatch in the translation for the following message:
The placeholder
%(validator)sin the original message is incorrectly translated as%(validador)esin the Portuguese message. The correct translation should maintain the same placeholder names:Ensure that all placeholders in the translated strings match the original placeholders exactly. This should resolve the "not enough arguments for format string" error [1].
To continue talking to Dosu, mention @dosu.
lulrich commentedon Nov 5, 2024
I don't know if they've already solved this problem or not, but I fixed it by changing these translations here
deleting the space between % and (
and I've also changed these here
removing the space after _
rusackas commentedon Apr 21, 2025
I don't see
% ((with the space) in the current codebase, so I'll assume this is resolved, and that's why it's been silent here for upward of 6 months. Holler if this needs to be reopened for whatever reason!vit-opti commentedon Apr 22, 2026
Still present in version 6.0.0 with the French translation.
The string
"Running block %(block_num)s out of %(block_count)s"insql_lab.pyis translated intranslations/fr/LC_MESSAGES/messages.jsonas:The variables
%(block_num)sand%(block_count)sare replaced by%(statement_num)sand%(statement_count)s, which do not exist in the format call, causing aKeyError('statement_num')that propagates as aSupersetErrorsExceptionand makes every SQL Lab query fail — includingSELECT 1.Workaround: add
BABEL_DEFAULT_LOCALE = "en"insuperset_config.py.The fix would be to correct the French translation to use the right variable names: