Repository navigation
fix(ui): show why indexing failed instead of a generic server error - #5643
Conversation
When a document failed to index, the Agent UI showed only "Server error. Please try again." even though the backend had said why (e.g. a missing dependency), so users had nothing to act on. A 500 now shows the backend's detail, falling back to the generic text only when the body carries no real cause (empty, Starlette's bare "Internal Server Error", HTML, or raw JSON). The RAG SDK also sent legacy .xls files to openpyxl, which cannot read them; it now raises a clear "save it as .xlsx" error instead. Refs amd#2741
That branch already refuses .xls with the shared convert-to-.xlsx message; keeping a second copy here would conflict with it. Refs amd#2741
The UI server's catch-all answers {"detail": "Internal server error"}, which the case-sensitive check showed verbatim instead of the friendly fallback. Compare case-insensitively in both the fetch and streaming paths.
Refs amd#2741
|
Verdict: Request changes — the code is right; what's missing is proof it works in the app. When indexing fails with a server error, the Agent UI now shows the backend's actual reason instead of "Server error. Please try again.", and keeps the generic text only when the server gave no real cause. The logic is small, well-tested, and doesn't regress any existing case.
Real-world evidenceN/A: no evidence bundle was produced for this run, so nothing ran on the live surface. This verdict comes from static review plus the PR's reported unit-test results. The Agent UI screenshot is still owed (see above). 🔍 Technical details🟡 Missing real-world evidence for a UI-visible change 🟢 The bracket heuristic drops real If you take this, add one Strengths
|
|
Real-world evidence from the live Agent UI. A corrupt
The backend returns the same 500 and the same 🔍 Technical details
The message shows the server's stored filename ( The bracket-prefixed case ( |
…heets right (amd#5812) Uploading a damaged `.xlsx`, a legacy `.xls` or password-protected workbook, or one with no data used to fail with a 500 carrying openpyxl's raw text ("File is not a zip file"). An empty workbook "indexed" as nothing but sheet names. Each now shows a clear "can't be read" message saying what to do, the same way damaged PDFs do. Spreadsheets with a merged title row above the table, like a lab report, lost their column names (LDL, HDL), so questions about a column found nothing. Those now index with the right labels. The crash in amd#2741 itself no longer reproduces on main: `openpyxl` was added to the `ui` extra in amd#2932, and amd#5643 made the UI show the backend's reason. On a cold `GAIA_HOME`, a simple sheet and a multi-sheet workbook with formulas and merged cells both upload and index. This PR fixes what was still wrong with Excel files after that. Closes amd#2741 ## Test plan - [x] `pytest tests/unit/rag/test_xlsx_extraction.py`: real LibreOffice-saved fixtures (formulas with cached values, merged title row, merged note, empty sheet, real `.xls`), plus corrupt, empty, `.xls`-named and missing-openpyxl cases, through both RAG and `POST /api/documents/upload` - [x] `pytest tests/unit/rag tests/unit/chat/ui/test_library_index_errors.py tests/unit/chat/ui/test_server.py`: 535 passed - [x] `npx vitest run src/components/__tests__/UnsupportedFeature.test.tsx src/components/__tests__/DocumentLibrary.test.tsx` and `npx tsc --noEmit` - [x] `python util/lint.py --all` passes - [x] Real server on an empty `GAIA_HOME` with live Lemonade embeddings: valid workbooks return 200; a corrupt, a blank and a renamed `.xls` workbook each return 422 with `corrupted` / `empty_file` / `unsupported_workbook` and a remedy, on both `/upload` and `/upload-path` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
When a document failed to index, the Agent UI showed only "Server error. Please try again.", even when the backend said exactly why (in #2741, a missing spreadsheet library). Users had nothing to act on. A 500 now shows the backend's reason. The generic text stays only when the body carries no real cause: an empty body, a bare "Internal server error", an HTML page, or raw JSON.
Refs #2741. The root cause there (
openpyxlmissing) was already fixed by #2932.Test plan
npx vitest run src/services/__tests__/api.test.ts src/services/__tests__/api.sendError.test.ts: 21 pass, including 500-with-detail through fetch and upload, and the fallback casesnpx tsc --noEmitis clean.xlsx: the error names the indexing failure instead of "Server error"