Repository navigation
Backlog
Description
Do you need to file an issue?
- I have searched the existing issues and this bug is not already filed.
- I believe this is a legitimate bug, not just a question or feature request.
Describe the bug
Uploading a valid .xlsx workbook to POST /api/question-notebook/practice/import/preview fails with HTTP 500 (AttributeError: 'Chartsheet' object has no attribute 'max_column') whenever the workbook's active tab is a standalone chartsheet — even if the workbook contains valid question worksheets.
Root cause:
deeptutor/services/practice/importing.py(parse_rows) readssheet = book.activeand immediately accessessheet.max_columnandsheet.iter_rows().- In
openpyxl,book.activecan be aChartsheet(which has neithermax_columnnoriter_rows()). deeptutor/api/routers/practice.py(import_preview) convertsValueErrorand known archive/parse errors to HTTP 422, so the unhandledAttributeErrorsurfaces as an HTTP 500.
This is the same class of openpyxl chartsheet issue previously fixed for chat attachment extraction in #2817 / #2960.
Steps to reproduce
- Create a valid
.xlsxworkbook with a standalone chartsheet tab set as active and a normal worksheet tab containing valid practice questions (or a chart-only workbook). - Open
/learning/practice→ Import, and upload the.xlsxfile (callingPOST /api/question-notebook/practice/import/preview). - Observe HTTP 500 in browser DevTools (Network) and
AttributeError: 'Chartsheet' object has no attribute 'max_column'in backend logs. - I have a focused fix and regression tests ready and will open a PR targeting dev shortly.
Expected Behavior
- If
book.activeis a normal worksheet, continue reading it as before. - If
book.activeis aChartsheet(not inbook.worksheets), fall back to the first worksheet (book.worksheets[0]) and preview its questions (HTTP 200). - If the workbook has no ordinary worksheets at all (chart-only), raise
ValueError("The workbook has no active worksheet")so the API returns HTTP 422 instead of HTTP 500.
Related Module
API/Backend
Configuration Used
No response
Logs and screenshots
Additional Information
- DeepTutor Version: dev (1.7.4)
- Operating System: Windows
- Python Version: 3.12.10
- Node.js Version: 24.12.0
- Related Issues: [Bug]: XLSX extraction crashes on standalone chartsheet tabs #2817
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity
Qiuner commentedon Dec 4, 2026
Thanks for the clear reproduction. #3248 covers the practice import path, including falling back to a normal worksheet and returning a validation error for chart-only files. #2817 covers chat attachments, so the two reports track separate import paths.