From 9a36d6f70bd88ce11e712a1ab64375c0d2d2ec33 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Thu, 18 Jun 2026 16:28:56 -0700 Subject: [PATCH] #889: precise error + diagnostics when a track's file can't be located for re-identify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The apply endpoint silently fell back to the raw stored DB path when the resolver missed, producing a confusing 'Source file not found: '. Now: resolve via the app's strong _resolve_library_file_path (keeps #833 confusable folding), and on a miss run the diagnostic resolver to log + report exactly which transfer/download/ library/Plex dirs were searched and whether the raw path existed — so a media-server- only or stale-path track gives a clear 'SoulSync can't read this file' instead of a dead end. No mutation happens on this path (fail-safe; nothing staged/deleted). --- web_server.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/web_server.py b/web_server.py index 2cea211d..0d0194a3 100644 --- a/web_server.py +++ b/web_server.py @@ -10127,7 +10127,29 @@ def reidentify_apply(): conn.close() if not row or not row['file_path']: return jsonify({"success": False, "error": "Library track has no file on disk"}), 404 - real_path = _resolve_library_file_path(row['file_path']) or row['file_path'] + stored_path = row['file_path'] + + # Resolve the stored DB path to a file THIS process can actually read, using + # the SAME strong resolver the rest of the app uses (transfer/download/library/ + # Plex search + #833 confusable folding via find_on_disk). + real_path = _resolve_library_file_path(stored_path) + if not real_path: + # On a miss, run the diagnostic variant purely to tell us (and the user) + # what was tried — instead of failing on the raw, possibly-stale path. + from core.library.path_resolver import resolve_library_file_path_with_diagnostic + try: + _plex = media_server_engine.client('plex') if media_server_engine else None + except Exception: + _plex = None + _, attempt = resolve_library_file_path_with_diagnostic( + stored_path, config_manager=config_manager, plex_client=_plex) + searched = ", ".join(attempt.base_dirs_tried) or "(no library/transfer/download dirs configured)" + logger.warning("[Re-identify] could not locate track %s file — stored=%s raw_exists=%s searched=[%s]", + library_track_id, stored_path, attempt.raw_path_existed, searched) + return jsonify({"success": False, "error": ( + f"SoulSync couldn't find this track's file on disk.\nStored path: {stored_path}\n" + f"Searched: {searched}.\nIf the file lives on a media server SoulSync can't read directly " + f"(or the stored path is stale), re-identify isn't available for it.")}), 404 # 3) Copy into staging + fingerprint the copy. staging_dir = docker_resolve_path(config_manager.get('import.staging_path', './Staging'))