Handle unavailable restore archives without HTTP 500 or a stuck loading state
Opening an archive that is no longer available in the job's current repository produces a generic HTTP 500 / internal error. The file browser then keeps displaying "Loading files" because its loading state is not cleared on the error path.
Related implementation PR: #494. Found during external acceptance testing of #486 on Unraid 7.3.2 with test-channel version 2026.09.09.1010.
Confirmed failure
On 2026-09-10 at 11:39:39, the file-list request selected test_praefix-2026-09-10_11-29-18 after the same job had been switched from repository 1 to repository 2. That archive was still in repository 1 and did not exist in repository 2.
The support log records:
GET /api/restore/files?... status=500 code=internal_error
reason: borg list failed: Archive test_praefix-2026-09-10_11-29-18 does not exist
The tester subsequently saw "Loading files" indefinitely. An isolated execution of restoreBrowse() with a mocked failing response confirms that the loading-spinner markup remains after the error is reported. This is not evidence of a Borg process still loading data.
Required behavior and acceptance
- Treat an unavailable archive as an actionable, handled condition rather than an undifferentiated internal server error.
- Explain in German and English that the selected archive is no longer available in the current repository and that the archive selection needs to be refreshed.
- Clear the file-browser loading indicator on handled failures, unexpected API failures, network failures and invalid responses.
- Remove stale file selections and prevent continuing with an invalid restore/precheck context.
- Allow the user to refresh/reselect a valid archive and continue without a service restart.
- Keep diagnostic details in the existing server log without disclosing secrets to the UI.
- Add focused coverage for a missing archive, generic request failures and recovery to a successful file listing.
Scope boundary
Refreshing the archive list after backup/repository changes is tracked separately. This error handling is still needed if an archive disappears between listing and opening it, for example through normal pruning. Do not change retention policy, repository contents or the restore workflow layout.
Relevant code: api/restore_api.py:list_files, archive-browser error propagation and the HTTP handler, plus ui/js/pages/restore.js:restoreBrowse.
User impact: understandable failure and a usable file browser instead of an apparently endless operation. Release note required. This issue is open work for PR #494, not a completed fix.
Implemented in 8bd84ac: a missing Borg archive returns restore_archive_unavailable (HTTP 404) with German/English guidance instead of a generic internal error. Missing-archive, other server, network and malformed-response failures clear the loading state and invalid file/precheck selections. Users can reselect the job/archive or retry.
Verification: executable UI tests cover both languages, retry after failures and a late error arriving after a successful new selection. A local HTTP test with Borg 1.4.5 confirmed the actual missing-archive error mapping for both a repository switch and archive removal. A valid selection worked afterwards, and an extracted test file was byte-identical to its source.
Retest: follow the original repository-switch sequence, open an archive and restore a small file into a separate test directory. If a selection becomes unavailable, the page should show a useful error and remain usable without a service restart.
Included in PR #494, test-channel version 2026.09.10.1549. Final source: 366ebb4f448d2c19bbe50636310926e28b11278b. The final pushed commit passed the full preflight once: 935 tests passed, none skipped, plus Python syntax checks.
Test-channel manifest. Existing migrated test installations can update directly; these fixes add no new migration. Keep this issue open pending the external retest and PR acceptance.