pipina opened a new issue, #36682:
URL: https://github.com/apache/superset/issues/36682

   ### Bug description
   
   # 🐞 CSV email reports fail with HTTP 500 when using non-default CSV 
delimiter (GUI CSV export works)
   
   **Superset version:** Apache Superset 5.0.0
   **Deployment:** Helm chart
   **Docker image:** `apachesuperset.docker.scarf.sh/apache/superset`
   **Base OS:** Debian Bookworm
   **Python:** 3.10
   **Pandas:** default dependency
   **Celery:** enabled (reports/alerts)
   **Email reports:** enabled
   **Locale:** `sk_SK.UTF-8` (not the root cause, listed for completeness)
   
   **Problem description**
   CSV downloads from the Superset GUI work correctly even when `CSV_EXPORT` is 
configured with a non-default delimiter (e.g. `;`) and decimal separator (e.g. 
`,`). However, CSV email reports fail with an internal server error (HTTP 500). 
The failure occurs only in the email reporting workflow and does not affect 
manual CSV exports from the UI.
   
   **Configuration used**
   
   ```yaml
   bootstrapScript: |
     #!/bin/bash
   
     apt-get update && \
       apt-get install -y locales && \
       apt autoremove -y && \
       apt clean
     localedef -i sk_SK -f UTF-8 sk_SK.UTF-8
   
     rm -rf /var/lib/apt/lists/*
   
     uv pip install Pillow \
       psycopg2-binary \
       cx_Oracle \
       sqlalchemy-vertica-python \
       pymssql \
       redis==4.6.0 \
       openpyxl \
       playwright \
       && playwright install-deps \
       && PLAYWRIGHT_BROWSERS_PATH=/usr/local/share/playwright-browsers 
playwright install chromium
   ```
   
   ```python
   CSV_EXPORT = {
       "encoding": "cp1250",
       "sep": ";",
       "decimal": ","
   }
   ```
   
   **Steps to reproduce**
   
   1. Deploy Apache Superset 5.0.0 using the configuration above.
   2. Configure CSV export with a non-default delimiter and decimal separator 
as shown.
   3. Create a chart with two columns.
   4. Download the CSV from the Superset GUI — works correctly.
   5. Create and schedule an email report for the same chart with a CSV 
attachment.
   6. Let the report execute via Celery, or manually trigger the endpoint used 
by reports:
   
   ```bash
   curl -H "Authorization: Bearer $TOKEN" \
     
"http://superset.superset.svc.cluster.local:8088/api/v1/chart/159/data/?format=csv&type=post_processed&force=false";
   ```
   
   **Actual behavior**
   When the CSV is generated as part of an email report, Superset returns HTTP 
500 – Internal Server Error.
   
   Client/API response:
   
   ```html
    curl   -H "Authorization: Bearer $TOKEN"   
"http://superset.superset.svc.cluster.local:8088/api/v1/chart/159/data/?format=csv&type=post_processed&force=false";
   <!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta 
http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" 
content="width=q,initial-scale=1"/><link rel="icon" type="image/png" 
href="/static/assets/e3bafb62eb2592c0bb0e.png"/><link 
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap"; 
rel="stylesheet"/><style>html {
           height: 100%;
         }
         body {
           color: #1985a0;
           font-family: 'Inter', sans-serif;
           height: 100%;
           margin: 0;
           display: flex;
           align-items: stretch;
         }
         h1 {
           font-weight: 600;
           font-size: 88px;
           margin: 0;
         }
         p {
           font-weight: 500;
           font-size: 24px;
           line-height: 40px;
           width: 490px;
         }
         .button {
           -webkit-appearance: button;
           -moz-appearance: button;
           appearance: button;
           background-color: #1985a0; /* Green */
           border: none;
           color: white;
           padding: 16px 38px;
           text-align: center;
           text-decoration: none;
           display: inline-block;
           font-size: 11px;
           border-radius: 4px;
           text-transform: uppercase;
         }
         .error-page-content {
           display: flex;
           flex-direction: row;
           align-items: center;
           justify-content: space-between;
           max-width: 1350px;
           margin: auto;
           width: 100%;
           padding: 56px;
         }
         img {
           width: 540px;
         }</style><title>500: Internal server error | 
Superset</title></head><body><div 
class="error-page-content"><section><h1>Internal server error</h1><p>Sorry, 
something went wrong. We are fixing the mistake now. Try again later or go back 
to home.</p><a href="/" class="button">Back to home</a></section><img alt="500" 
src="/static/assets/b01fb73b111d937e4c09.png" 
width="540"/></div></body></html>root@superset-worker-695fff8dbb-ssqnv:/app
   ```
   
   Superset application logs:
   
   ```text
   2025-12-16 21:11:00,667:WARNING:superset.views.error_handling:Exception
   Traceback (most recent call last):
     File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1484, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1469, in 
dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
     File "/app/superset/charts/data/api.py", line 359, in _send_chart_response
       result = apply_client_processing(result, form_data, datasource)
     File "/app/superset/charts/client_processing.py", line 330, in 
apply_client_processing
       df = pd.read_csv(StringIO(data))
     File 
"/app/.venv/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 
912, in read_csv
       return _read(filepath_or_buffer, kwds)
     File "pandas/_libs/parsers.pyx", line 2029, in 
pandas._libs.parsers.raise_parser_error
   pandas.errors.ParserError: Error tokenizing data.
   C error: Expected 2 fields in line 14, saw 3
   ```
   
   ```text
   2025-12-16 21:11:00,668:ERROR:superset.views.error_handling:
   Error tokenizing data. C error: Expected 2 fields in line 14, saw 3
   ```
   
   **Summary**
   CSV email reports fail with HTTP 500 due to a Pandas parsing error during 
client-side post processing. The issue does not affect CSV downloads from the 
GUI and appears isolated to the email/report execution path, where `CSV_EXPORT` 
delimiter settings are ignored when CSV data is re-parsed.
   
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   5.0.0
   
   ### Python version
   
   3.10
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to