From c477676367488bc41fdf6a2525600d50118dcc18 Mon Sep 17 00:00:00 2001 From: devs6186 Date: Thu, 19 Feb 2026 21:59:56 +0530 Subject: [PATCH] [tasks/init] Handle missing repo in augur_handle_task_failure When detect_github_repo_move updates the repo_git in the DB and then raises an exception, the failure handler was looking up the repo by the now-stale old URL, causing a NoResultFound that masked the original error. Switched to one_or_none() and return early with a warning when the repo is not found. Fixes #3421 Signed-off-by: devs6186 --- augur/tasks/init/celery_app.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/augur/tasks/init/celery_app.py b/augur/tasks/init/celery_app.py index d1209fadd0..24c4166e5c 100644 --- a/augur/tasks/init/celery_app.py +++ b/augur/tasks/init/celery_app.py @@ -87,7 +87,14 @@ def augur_handle_task_failure(self,exc,task_id,repo_git,logger_name,collection_h with get_session() as session: logger.info(f"Repo git: {repo_git}") - repo = session.query(Repo).filter(Repo.repo_git == repo_git).one() + repo = session.query(Repo).filter(Repo.repo_git == repo_git).one_or_none() + + if repo is None: + logger.warning( + f"Repo with git url {repo_git} not found during failure handling " + f"(it may have been renamed); skipping status update." + ) + return repoStatus = repo.collection_status[0]