forked from SWISDATA/processintel
ui.home: non-UTF-8 or malformed CSV files crash the import #14
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ffrauenberger/ProcessIntel#14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: medium (common Excel CSV exports show an exception page)
Where
app/ui/home_ui/home_controller.py:122-140,:272-296app/io_operations/import_operations.py:10-28,:106-126app/analysis/detection_model.py:68-90Problem
HomeController.set_df, the CSV branch callsself.import_model.read_csv(...)without a try/except (only the XES branch is protected). AUnicodeDecodeError(e.g. a cp1252/Latin-1 export from Excel, very common in the DACH region) or apandas.errors.ParserError(wrong delimiter, ragged rows) is raised inside a buttonon_clickcallback and shows a Streamlit exception page.read_linedecodes the first line as UTF-8. If that fails, delimiter detection silently falls back to",".encoding="utf-8-sig"is not used), so the first column name starts withand column prediction does not recognize e.g.case.csv.Snifferon a single line can pick odd characters, such as a letter that occurs in every field name.Steps to reproduce
Alternatively: upload a CSV with ragged rows, or a UTF-8 CSV with BOM.
Expected behavior
The file is imported, or the user gets a clear message explaining the problem (encoding, delimiter, malformed rows).
Actual behavior
A Streamlit exception page (
UnicodeDecodeError/ParserError). For files with BOM, the first column is not recognized.Fix
Wrap CSV reading in error handling with a user-facing message. Try
utf-8-sigfirst and fall back to a detected or user-selected encoding. Sniff the delimiter on a sample of several lines.from
issues/BUG-014-csv-import-encoding-and-parse-errors-crash.md(code analysis of commit6bcc646, 2026-10-03)Reviewed by Codex (GPT-6) against origin/main
6bcc646eb464.Review: partially correct.
The encoding/parser error-handling findings are supported, but the BOM claim is incorrect for the reviewed environment. Reproduced
ImportOperations.read_csv()on UTF-8 BOM bytes with pandas 2.3.3: the columns are['case', 'event', 'time'], with no leading BOM. pandas handles the initial UTF-8 BOM even though this call does not specifyencoding='utf-8-sig'. Remove “the first column name starts with BOM” and the BOM-only failure reproduction. Encoding choices, error handling and multi-line delimiter sampling remain valid improvements.Code references: app/io_operations/import_operations.py:27, app/ui/home_ui/home_controller.py:138.