You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/05/04 18:44:29 UTC

(tooling-trusted-releases) branch sbp updated: Convert storage access errors into the relevant HTTP errors

This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/sbp by this push:
     new dbcc26f6 Convert storage access errors into the relevant HTTP errors
dbcc26f6 is described below

commit dbcc26f6d29a17e897634d3304283dbbd49d7013
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Mon May 4 19:43:38 2026 +0100

    Convert storage access errors into the relevant HTTP errors
---
 atr/api/__init__.py                   | 52 ++++++++++++++++---------
 atr/blueprints/api.py                 |  6 +++
 atr/get/root.py                       |  4 +-
 atr/post/upload.py                    | 11 ++++++
 atr/server.py                         | 11 ++++++
 atr/storage/__init__.py               | 57 ++++++++++++++-------------
 atr/storage/writers/announce.py       | 27 +++++++------
 atr/storage/writers/cache.py          |  6 +--
 atr/storage/writers/checks.py         | 14 +++----
 atr/storage/writers/distributions.py  | 10 ++---
 atr/storage/writers/keys.py           | 52 +++++++++++++++----------
 atr/storage/writers/mail.py           |  6 +--
 atr/storage/writers/policy.py         | 12 +++---
 atr/storage/writers/project.py        | 24 ++++++------
 atr/storage/writers/release.py        | 57 ++++++++++++++-------------
 atr/storage/writers/revision.py       | 16 ++++----
 atr/storage/writers/sbom.py           |  6 +--
 atr/storage/writers/ssh.py            | 10 ++---
 atr/storage/writers/tokens.py         | 12 +++---
 atr/storage/writers/user.py           |  8 ++--
 atr/storage/writers/vote.py           | 73 ++++++++++++++++++-----------------
 atr/storage/writers/workflowstatus.py |  6 +--
 tests/unit/test_upload_json.py        | 16 ++++----
 23 files changed, 286 insertions(+), 210 deletions(-)

diff --git a/atr/api/__init__.py b/atr/api/__init__.py
index af2db007..cea9e11b 100644
--- a/atr/api/__init__.py
+++ b/atr/api/__init__.py
@@ -294,9 +294,7 @@ async def distribute_ssh_register(
     )
     # Validate that the task ID passed exists and was started by the UID asserted
     async with db.session() as _data:
-        await _data.task(id=int(data.task_id), asf_uid=data.asf_uid).demand(
-            exceptions.Unauthorized("Unauthorized"),
-        )
+        await _data.task(id=int(data.task_id), asf_uid=data.asf_uid).demand(exceptions.NotFound("Task not found"))
     async with storage.write_as_committee_member(util.unwrap(project.committee).key, asf_uid) as wacm:
         fingerprint, expires = await wacm.ssh.add_workflow_key(
             payload.actor,
@@ -335,7 +333,7 @@ async def distribution_record(
             version=str(data.version),
         ).demand(exceptions.NotFound(f"Release {data.project!s} {data.version!s} not found"))
     if release.committee is None:
-        raise exceptions.NotFound(f"Release {release.key} has no committee")
+        raise exceptions.InternalServerError(f"Release {release.key} has no committee")
     dd = models.distribution.Data(
         platform=data.platform,
         owner_namespace=data.distribution_owner_namespace,
@@ -381,13 +379,11 @@ async def distribution_record_from_workflow(
     )
     # Validate that the task ID passed exists and was started by the UID asserted
     async with db.session() as _data:
-        await _data.task(id=int(data.task_id), asf_uid=data.asf_uid).demand(
-            exceptions.Unauthorized("Unauthorized"),
-        )
+        await _data.task(id=int(data.task_id), asf_uid=data.asf_uid).demand(exceptions.NotFound("Task not found"))
     util.validate_distribution_owner_namespace(data.platform, data.distribution_owner_namespace)
     # TODO: Split the below code into a new function and reuse in /publisher and /distribution / record.
     if release.committee is None:
-        raise exceptions.NotFound(f"Release {release.key} has no committee")
+        raise exceptions.InternalServerError(f"Release {release.key} has no committee")
     dd = models.distribution.Data(
         platform=data.platform,
         owner_namespace=data.distribution_owner_namespace,
@@ -762,7 +758,9 @@ async def policy_update(
     try:
         async with storage.write_as_project_committee_member(data.project, asf_uid) as wacm:
             await wacm.policy.edit_policy(data.project, data)
-    except (storage.AccessError, ValueError) as e:
+    except storage.AccessError as e:
+        raise _http_exception_from_storage_access_error(e) from e
+    except ValueError as e:
         raise exceptions.BadRequest(str(e))
     return models.api.PolicyUpdateResults(
         endpoint="/policy/update",
@@ -858,7 +856,7 @@ async def publisher_distribution_record(
             version=str(data.version),
         ).demand(exceptions.NotFound(f"Release {project.key} {data.version!s} not found"))
     if release.committee is None:
-        raise exceptions.NotFound(f"Release {release.key} has no committee")
+        raise exceptions.InternalServerError(f"Release {release.key} has no committee")
     dd = models.distribution.Data(
         platform=data.platform,
         owner_namespace=data.distribution_owner_namespace,
@@ -909,7 +907,7 @@ async def publisher_release_announce(
                 fullname=asf_uid,
             )
     except storage.AccessError as e:
-        raise exceptions.BadRequest(str(e))
+        raise _http_exception_from_storage_access_error(e) from e
 
     return models.api.PublisherReleaseAnnounceResults(
         endpoint="/publisher/release/announce",
@@ -976,7 +974,7 @@ async def publisher_vote_resolve(
                 f"The vote {data.resolution}.",
             )
     except storage.AccessError as e:
-        raise exceptions.BadRequest(str(e))
+        raise _http_exception_from_storage_access_error(e) from e
 
     return models.api.PublisherVoteResolveResults(
         endpoint="/publisher/vote/resolve",
@@ -1018,7 +1016,7 @@ async def release_announce(
                 fullname=asf_uid,
             )
     except storage.AccessError as e:
-        raise exceptions.BadRequest(str(e))
+        raise _http_exception_from_storage_access_error(e) from e
 
     return models.api.ReleaseAnnounceResults(
         endpoint="/release/announce",
@@ -1049,7 +1047,7 @@ async def release_create(
             wacp = await write.as_project_committee_participant(data.project)
             release, _project = await wacp.release.start(data.project, data.version)
     except storage.AccessError as e:
-        raise exceptions.BadRequest(str(e))
+        raise _http_exception_from_storage_access_error(e) from e
 
     return models.api.ReleaseCreateResults(
         endpoint="/release/create",
@@ -1543,7 +1541,7 @@ async def vote_resolve(
                 f"The vote {data.resolution}.",
             )
     except storage.AccessError as e:
-        raise exceptions.BadRequest(str(e))
+        raise _http_exception_from_storage_access_error(e) from e
     # except Exception as e:
     #     import atr.log as log
     #     import traceback
@@ -1575,11 +1573,11 @@ async def vote_start(
     try:
         async with db.session() as db_data:
             project = await db_data.project(key=str(data.project), _committee=True).demand(
-                storage.AccessError(f"Project not found: {data.project}")
+                storage.AccessError(f"Project not found: {data.project}", status=404)
             )
             committee = project.committee
             if committee is None:
-                raise storage.AccessError("No committee found for project - Invalid state")
+                raise storage.AccessError("No committee found for project - Invalid state", status=500)
         async with storage.write_as_committee_participant(committee.key, asf_uid) as wacp:
             permitted_recipients = util.permitted_podling_first_round_recipients(
                 asf_uid,
@@ -1610,7 +1608,7 @@ async def vote_start(
     #     log.info(traceback.format_exc())
     #     raise exceptions.BadRequest(str(e))
     except storage.AccessError as e:
-        raise exceptions.BadRequest(str(e))
+        raise _http_exception_from_storage_access_error(e) from e
 
     return models.api.VoteStartResults(
         endpoint="/vote/start",
@@ -1661,6 +1659,24 @@ async def vote_tabulate(
     ).model_dump(mode="json"), 200
 
 
+def _http_exception_from_storage_access_error(error: storage.AccessError) -> exceptions.HTTPException:
+    message = str(error)
+    status = error.status or 500
+    if status == 400:
+        return exceptions.BadRequest(message)
+    if status == 401:
+        return exceptions.Unauthorized(message)
+    if status == 403:
+        return exceptions.Forbidden(message)
+    if status == 404:
+        return exceptions.NotFound(message)
+    if status == 409:
+        return exceptions.Conflict(message)
+    if status == 502:
+        return exceptions.BadGateway(message)
+    return exceptions.InternalServerError(message)
+
+
 def _issuer_matches_component(
     fingerprint: str,
     key_id: str,
diff --git a/atr/blueprints/api.py b/atr/blueprints/api.py
index bfd129ed..13d3cba6 100644
--- a/atr/blueprints/api.py
+++ b/atr/blueprints/api.py
@@ -33,6 +33,7 @@ import werkzeug.exceptions as exceptions
 import atr.blueprints.common as common
 import atr.config as config
 import atr.log as log
+import atr.storage as storage
 import atr.web as web
 
 _BLUEPRINT_NAME: Final = "api_blueprint"
@@ -184,6 +185,11 @@ async def _handle_request_validation(err: quart_schema.RequestSchemaValidationEr
     return _json_error("Input validation failed", 400, {"validation_details": verr.errors()})
 
 
+@_BLUEPRINT.errorhandler(storage.AccessError)
+async def _handle_storage_access_error(err: storage.AccessError) -> tuple[quart.Response, int]:
+    return _json_error(str(err), err.status or 500)
+
+
 def _json_error(
     message: str, status_code: int | None, extra: dict[str, Any] | None = None
 ) -> tuple[quart.Response, int]:
diff --git a/atr/get/root.py b/atr/get/root.py
index 15c90333..79650a90 100644
--- a/atr/get/root.py
+++ b/atr/get/root.py
@@ -144,12 +144,12 @@ async def index(_session: web.Public, _root: Literal[""]) -> quart_response.Resp
 
 
 @get.typed
-async def notfound(_session: web.Public, _about: Literal["notfound"]) -> str:
+async def notfound(_session: web.Public, _about: Literal["notfound"]) -> tuple[str, int]:
     """
     URL: /notfound
     Not found page.
     """
-    return await template.render("notfound.html", error="404 Not Found", status_code=404)
+    return await template.render("notfound.html", error="404 Not Found", status_code=404), 404
 
 
 @get.typed
diff --git a/atr/post/upload.py b/atr/post/upload.py
index a02baec2..e2382922 100644
--- a/atr/post/upload.py
+++ b/atr/post/upload.py
@@ -110,6 +110,17 @@ async def _add_files(
             project_key=project_key,
             version_key=version_key,
         )
+    except storage.AccessError as e:
+        status = e.status or 500
+        log.warning(f"Upload access error: {e!s}")
+        if wants_json:
+            return quart.jsonify(ok=False, message=str(e)), status
+        await quart.flash(str(e), "error")
+        return await session.redirect(
+            get.upload.selected,
+            project_key=project_key,
+            version_key=version_key,
+        )
     except Exception as e:
         log.exception("Error adding file:")
         if wants_json:
diff --git a/atr/server.py b/atr/server.py
index 1640876d..f848d1df 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -44,6 +44,7 @@ import quart
 import quart_rate_limiter as rate_limiter
 import quart_schema
 import quart_wtf
+import werkzeug.exceptions as exceptions
 import werkzeug.routing as routing
 
 import atr
@@ -984,6 +985,16 @@ async def _register_recurrent_tasks() -> None:
 
 def _register_routes(app: base.QuartApp) -> None:  # noqa: C901
     # Add a global error handler to show helpful error messages with tracebacks
+    @app.errorhandler(exceptions.HTTPException)
+    async def handle_http_exception(error: exceptions.HTTPException) -> Any:
+        status_code = error.code or 500
+        name = error.name or "HTTP error"
+        description = error.description or name
+        message = f"{status_code} {name}: {description}"
+        if quart.request.path.startswith("/api"):
+            return quart.jsonify({"error": message}), status_code
+        return await template.render("error.html", error=message, status_code=status_code), status_code
+
     @app.errorhandler(Exception)
     async def handle_any_exception(error: Exception) -> Any:
         import traceback
diff --git a/atr/storage/__init__.py b/atr/storage/__init__.py
index f118ab03..926f6b62 100644
--- a/atr/storage/__init__.py
+++ b/atr/storage/__init__.py
@@ -60,7 +60,10 @@ class WriteAs(AccessAs): ...
 ## Access error
 
 
-class AccessError(RuntimeError): ...
+class AccessError(RuntimeError):
+    def __init__(self, message: str = "Storage access error", status: int | None = None) -> None:
+        self.status = status
+        super().__init__(message)
 
 
 # Read
@@ -159,7 +162,7 @@ class WriteAsFoundationCommitter(WriteAsGeneralPublic):
     @property
     def asf_uid(self) -> str:
         if self.__asf_uid is None:
-            raise AccessError("Not authorized")
+            raise AccessError("Not authorized", status=403)
         return self.__asf_uid
 
 
@@ -184,7 +187,7 @@ class WriteAsCommitteeParticipant(WriteAsFoundationCommitter):
     @property
     def asf_uid(self) -> str:
         if self.__asf_uid is None:
-            raise AccessError("No authorized")
+            raise AccessError("Not authorized", status=403)
         return self.__asf_uid
 
     @property
@@ -215,7 +218,7 @@ class WriteAsCommitteeMember(WriteAsCommitteeParticipant):
     @property
     def asf_uid(self) -> str:
         if self.__asf_uid is None:
-            raise AccessError("Not authorized")
+            raise AccessError("Not authorized", status=403)
         return self.__asf_uid
 
     @property
@@ -234,7 +237,7 @@ class WriteAsFoundationAdmin(WriteAsFoundationCommitter):
     @property
     def asf_uid(self) -> str:
         if self.__asf_uid is None:
-            raise AccessError("Not authorized")
+            raise AccessError("Not authorized", status=403)
         return self.__asf_uid
 
 
@@ -261,9 +264,9 @@ class Write:
 
     def as_committee_admin_outcome(self, committee_key: str) -> outcome.Outcome[WriteAsCommitteeAdmin]:
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not user.is_admin(self.__authorisation.asf_uid):
-            return outcome.Error(AccessError("Not an admin"))
+            return outcome.Error(AccessError("Not an admin", status=403))
         try:
             waca = WriteAsCommitteeAdmin(self, self.__data, committee_key)
         except Exception as e:
@@ -275,9 +278,11 @@ class Write:
 
     def as_committee_member_outcome(self, committee_key: str) -> outcome.Outcome[WriteAsCommitteeMember]:
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not self.__authorisation.is_member_of(committee_key):
-            return outcome.Error(AccessError(f"{self.__authorisation.asf_uid} is not a member of {committee_key}"))
+            return outcome.Error(
+                AccessError(f"{self.__authorisation.asf_uid} is not a member of {committee_key}", status=403)
+            )
         try:
             wacm = WriteAsCommitteeMember(self, self.__data, committee_key)
         except Exception as e:
@@ -289,9 +294,9 @@ class Write:
 
     def as_committee_participant_outcome(self, committee_key: str) -> outcome.Outcome[WriteAsCommitteeParticipant]:
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not self.__authorisation.is_participant_of(committee_key):
-            return outcome.Error(AccessError(f"Not a participant of {committee_key}"))
+            return outcome.Error(AccessError(f"Not a participant of {committee_key}", status=403))
         try:
             wacp = WriteAsCommitteeParticipant(self, self.__data, committee_key)
         except Exception as e:
@@ -303,7 +308,7 @@ class Write:
 
     def as_foundation_committer_outcome(self) -> outcome.Outcome[WriteAsFoundationCommitter]:
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         try:
             wafm = WriteAsFoundationCommitter(self, self.__data)
         except Exception as e:
@@ -315,9 +320,9 @@ class Write:
 
     def as_foundation_admin_outcome(self) -> outcome.Outcome[WriteAsFoundationAdmin]:
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not user.is_admin(self.__authorisation.asf_uid):
-            return outcome.Error(AccessError("Not an admin"))
+            return outcome.Error(AccessError("Not an admin", status=403))
         try:
             wafa = WriteAsFoundationAdmin(self, self.__data)
         except Exception as e:
@@ -345,14 +350,14 @@ class Write:
         self, project_key: safe.ProjectKey
     ) -> outcome.Outcome[WriteAsCommitteeAdmin]:
         project = await self.__data.project(str(project_key), _committee=True).demand(
-            AccessError(f"Project not found: {project_key}")
+            AccessError(f"Project not found: {project_key}", status=404)
         )
         if project.committee is None:
-            return outcome.Error(AccessError("No committee found for project - Invalid state"))
+            return outcome.Error(AccessError("No committee found for project - Invalid state", status=500))
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not user.is_admin(self.__authorisation.asf_uid):
-            return outcome.Error(AccessError("Not an admin"))
+            return outcome.Error(AccessError("Not an admin", status=403))
         try:
             waca = WriteAsCommitteeAdmin(self, self.__data, project.committee.key)
         except Exception as e:
@@ -367,14 +372,14 @@ class Write:
         self, project_key: safe.ProjectKey
     ) -> outcome.Outcome[WriteAsCommitteeMember]:
         project = await self.__data.project(str(project_key), _committee=True).demand(
-            AccessError(f"Project not found: {project_key}")
+            AccessError(f"Project not found: {project_key}", status=404)
         )
         if project.committee is None:
-            return outcome.Error(AccessError("No committee found for project - Invalid state"))
+            return outcome.Error(AccessError("No committee found for project - Invalid state", status=500))
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not self.__authorisation.is_member_of(project.committee.key):
-            return outcome.Error(AccessError(f"Not a member of {project.committee.key}"))
+            return outcome.Error(AccessError(f"Not a member of {project.committee.key}", status=403))
         try:
             wacm = WriteAsCommitteeMember(self, self.__data, project.committee.key)
         except Exception as e:
@@ -389,14 +394,14 @@ class Write:
         self, project_key: safe.ProjectKey
     ) -> outcome.Outcome[WriteAsCommitteeParticipant]:
         project = await self.__data.project(str(project_key), _committee=True).demand(
-            AccessError(f"Project not found: {project_key!s}")
+            AccessError(f"Project not found: {project_key!s}", status=404)
         )
         if project.committee is None:
-            return outcome.Error(AccessError("No committee found for project - Invalid state"))
+            return outcome.Error(AccessError("No committee found for project - Invalid state", status=500))
         if self.__authorisation.asf_uid is None:
-            return outcome.Error(AccessError("Not authorized"))
+            return outcome.Error(AccessError("Not authorized", status=403))
         if not self.__authorisation.is_participant_of(project.committee.key):
-            return outcome.Error(AccessError(f"Not a participant of {project.committee.key}"))
+            return outcome.Error(AccessError(f"Not a participant of {project.committee.key}", status=403))
         try:
             wacp = WriteAsCommitteeParticipant(self, self.__data, project.committee.key)
         except Exception as e:
diff --git a/atr/storage/writers/announce.py b/atr/storage/writers/announce.py
index b8ccd14e..6171e0f1 100644
--- a/atr/storage/writers/announce.py
+++ b/atr/storage/writers/announce.py
@@ -59,7 +59,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -77,7 +77,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -96,7 +96,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -117,7 +117,7 @@ class CommitteeMember(CommitteeParticipant):
         all_addrs = [email_to] + (email_cc or []) + (email_bcc or [])
         for addr in all_addrs:
             if addr not in permitted:
-                raise storage.AccessError(f"You are not permitted to send announcements to {addr}")
+                raise storage.AccessError(f"You are not permitted to send announcements to {addr}", status=403)
 
         unfinished_dir: str = ""
         finished_dir: str = ""
@@ -134,10 +134,11 @@ class CommitteeMember(CommitteeParticipant):
         ).demand(
             storage.AccessError(
                 f"Release {project_key!s} {version_key!s} {preview_revision_number!s} does not exist",
+                status=404,
             )
         )
         if (committee := release.project.committee) is None:
-            raise storage.AccessError("Release has no committee - Invalid state")
+            raise storage.AccessError("Release has no committee - Invalid state", status=500)
 
         policy = release.release_policy or release.project.release_policy
         if policy and policy.file_tag_mappings:
@@ -153,7 +154,8 @@ class CommitteeMember(CommitteeParticipant):
                 raise storage.AccessError(
                     f"This release cannot be announced until the following distributions have been recorded: {
                         ', '.join(missing)
-                    }"
+                    }",
+                    status=409,
                 )
 
         # Fetch the current subject template and verify the hash
@@ -161,7 +163,7 @@ class CommitteeMember(CommitteeParticipant):
         if subject_template_hash is not None:
             current_hash = construct.template_hash(subject_template)
             if current_hash != subject_template_hash:
-                raise storage.AccessError("Subject template has been modified since the form was loaded")
+                raise storage.AccessError("Subject template has been modified since the form was loaded", status=409)
 
         # Substitute the subject template
         options = construct.AnnounceReleaseOptions(
@@ -182,7 +184,7 @@ class CommitteeMember(CommitteeParticipant):
         finished_path = paths.release_directory(predicted_finished_release)
         finished_dir = str(finished_path)
         if await aiofiles.os.path.exists(finished_dir):
-            raise storage.AccessError("Release already exists")
+            raise storage.AccessError("Release already exists", status=409)
         # TODO: This is not reliable because of race conditions
         # But it adds a layer of protection in most cases
         preserve = release.project.policy_preserve_download_files
@@ -216,7 +218,7 @@ class CommitteeMember(CommitteeParticipant):
                     reason=f"user {self.__asf_uid} is releasing {project_key} {version_key} {preview_revision_number}",
                 )
         except Exception as e:
-            raise storage.AccessError(f"Error moving files: {e!s}")
+            raise storage.AccessError(f"Error moving files: {e!s}", status=500)
 
         # TODO: Add an audit log entry here
         # TODO: We should consider copying the files instead of hard linking
@@ -250,11 +252,12 @@ class CommitteeMember(CommitteeParticipant):
 
             await self.__promote_in_database(release, preview_revision_number, release_date)
             await self.__data.commit()
-        except storage.AccessError as e:
-            raise e
+        except storage.AccessError:
+            raise
         except Exception as e:
             raise storage.AccessError(
-                f"Files moved successfully, but error queuing announcement: {e!s}. Manual cleanup needed."
+                f"Files moved successfully, but error queuing announcement: {e!s}. Manual cleanup needed.",
+                status=500,
             )
 
     async def __hard_link_downloads(
diff --git a/atr/storage/writers/cache.py b/atr/storage/writers/cache.py
index fd7d590a..d47cb301 100644
--- a/atr/storage/writers/cache.py
+++ b/atr/storage/writers/cache.py
@@ -80,7 +80,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -98,7 +98,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -117,6 +117,6 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
diff --git a/atr/storage/writers/checks.py b/atr/storage/writers/checks.py
index 09c8d456..9a80f054 100644
--- a/atr/storage/writers/checks.py
+++ b/atr/storage/writers/checks.py
@@ -50,7 +50,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -68,7 +68,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -87,7 +87,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -132,7 +132,7 @@ class CommitteeMember(CommitteeParticipant):
     async def ignore_delete(self, id: int) -> None:
         cri = await self.__data.get(sql.CheckResultIgnore, id)
         if cri is None:
-            raise storage.AccessError(f"Ignore {id} not found")
+            raise storage.AccessError(f"Ignore {id} not found", status=404)
         await self.__validate_project_in_committee(cri.project_key)
         via = sql.validate_instrumented_attribute
         await self.__data.execute(sqlmodel.delete(sql.CheckResultIgnore).where(via(sql.CheckResultIgnore.id) == id))
@@ -155,7 +155,7 @@ class CommitteeMember(CommitteeParticipant):
     ) -> None:
         cri = await self.__data.get(sql.CheckResultIgnore, id)
         if cri is None:
-            raise storage.AccessError(f"Ignore {id} not found")
+            raise storage.AccessError(f"Ignore {id} not found", status=404)
         await self.__validate_project_in_committee(cri.project_key)
         _validate_ignore_patterns(
             release_glob,
@@ -182,9 +182,9 @@ class CommitteeMember(CommitteeParticipant):
     async def __validate_project_in_committee(self, project_key: str) -> None:
         project = await self.__data.project(project_key, _committee=True).get()
         if project is None:
-            raise storage.AccessError(f"Project {project_key} not found")
+            raise storage.AccessError(f"Project {project_key} not found", status=404)
         if project.committee_key != self.__committee_key:
-            raise storage.AccessError(f"Project {project_key} is not in committee {self.__committee_key}")
+            raise storage.AccessError(f"Project {project_key} is not in committee {self.__committee_key}", status=403)
 
 
 def _validate_ignore_patterns(*patterns: str | None) -> None:
diff --git a/atr/storage/writers/distributions.py b/atr/storage/writers/distributions.py
index a7eef55c..7472ffb5 100644
--- a/atr/storage/writers/distributions.py
+++ b/atr/storage/writers/distributions.py
@@ -51,7 +51,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -69,7 +69,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -88,7 +88,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -244,10 +244,10 @@ class CommitteeMember(CommitteeParticipant):
                         web_url=None,
                     )
                     return dist, added, None
-                raise storage.AccessError(f"Failed to get API response from distribution platform: {error}")
+                raise storage.AccessError(f"Failed to get API response from distribution platform: {error}", status=502)
         upload_date = distribution.distribution_upload_date(dd.platform, result, dd.version)
         if upload_date is None:
-            raise storage.AccessError("Failed to get upload date from distribution platform")
+            raise storage.AccessError("Failed to get upload date from distribution platform", status=502)
         web_url = distribution.distribution_web_url(dd.platform, result, dd.version)
         metadata = models.distribution.Metadata(
             api_url=api_url,
diff --git a/atr/storage/writers/keys.py b/atr/storage/writers/keys.py
index 06ebaa1f..aa8c4d76 100644
--- a/atr/storage/writers/keys.py
+++ b/atr/storage/writers/keys.py
@@ -201,7 +201,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
         # Specific to this module
@@ -213,7 +213,7 @@ class FoundationCommitter(GeneralPublic):
                 fingerprint=fingerprint,
                 apache_uid=self.__asf_uid,
                 _committees=True,
-            ).demand(storage.AccessError(f"Key not found: {fingerprint}"))
+            ).demand(storage.AccessError(f"Key not found: {fingerprint}", status=404))
             affected_committee_keys = {committee.key for committee in key.committees}
             await self.__data.delete(key)
             await self.__data.commit()
@@ -262,13 +262,13 @@ class FoundationCommitter(GeneralPublic):
 
     async def keys_file_text(self, committee_key: str) -> str:
         committee = await self.__data.committee(key=committee_key, _public_signing_keys=True).demand(
-            storage.AccessError(f"Committee not found: {committee_key}")
+            storage.AccessError(f"Committee not found: {committee_key}", status=404)
         )
         return await self._keys_file_text(committee)
 
     async def _keys_file_text(self, committee: sql.Committee) -> str:
         if not committee.public_signing_keys:
-            raise storage.AccessError(f"No keys found for committee {committee.key} to generate KEYS file.")
+            raise storage.AccessError(f"No keys found for committee {committee.key} to generate KEYS file.", status=404)
 
         sorted_keys = sorted(committee.public_signing_keys, key=lambda k: k.fingerprint)
 
@@ -311,7 +311,7 @@ class FoundationCommitter(GeneralPublic):
 
     async def _sync_committee_keys_file(self, committee_key: str) -> str | None:
         committee = await self.__data.committee(key=committee_key, _public_signing_keys=True).demand(
-            storage.AccessError(f"Committee not found: {committee_key}")
+            storage.AccessError(f"Committee not found: {committee_key}", status=404)
         )
         committee_keys_path = self._committee_keys_path(committee)
         committee_keys_dir = committee_keys_path.parent
@@ -321,7 +321,9 @@ class FoundationCommitter(GeneralPublic):
                 if await aiofiles.os.path.exists(committee_keys_path):
                     await aiofiles.os.remove(committee_keys_path)
             except OSError as e:
-                raise storage.AccessError(f"Failed to remove KEYS file for committee {committee_key}: {e}") from e
+                raise storage.AccessError(
+                    f"Failed to remove KEYS file for committee {committee_key}: {e}", status=500
+                ) from e
             return None
 
         full_keys_file_content = await self._keys_file_text(committee)
@@ -330,18 +332,21 @@ class FoundationCommitter(GeneralPublic):
             await asyncio.to_thread(util.chmod_directories, committee_keys_dir, permissions=0o755)
             await asyncio.to_thread(committee_keys_path.path.write_text, full_keys_file_content, encoding="utf-8")
         except OSError as e:
-            raise storage.AccessError(f"Failed to write KEYS file for committee {committee_key}: {e}") from e
+            raise storage.AccessError(
+                f"Failed to write KEYS file for committee {committee_key}: {e}", status=500
+            ) from e
         except Exception as e:
             log.exception(f"An unexpected error occurred writing KEYS for committee {committee_key}: {e}")
             raise storage.AccessError(
-                f"An unexpected error occurred writing KEYS for committee {committee_key}: {e}"
+                f"An unexpected error occurred writing KEYS for committee {committee_key}: {e}",
+                status=500,
             ) from e
         return str(committee_keys_path)
 
     async def test_user_delete_all(self, test_uid: str) -> outcome.Outcome[int]:
         """Delete all OpenPGP keys and their links for a test user."""
         if not config.is_test_mode():
-            return outcome.Error(storage.AccessError("Test key deletion not enabled"))
+            return outcome.Error(storage.AccessError("Test key deletion not enabled", status=403))
 
         try:
             test_user_keys = await self.__data.public_signing_key(apache_uid=test_uid, _committees=True).all()
@@ -389,7 +394,7 @@ class FoundationCommitter(GeneralPublic):
             _committees=True,
         ).get()
         if not key:
-            raise storage.AccessError("Key not found or not owned by you")
+            raise storage.AccessError("Key not found or not owned by you", status=404)
 
         old_committee_keys = {c.key for c in key.committees}
         new_committee_keys = set(selected_committee_keys)
@@ -592,7 +597,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -639,20 +644,24 @@ class CommitteeParticipant(FoundationCommitter):
             committee = await self.committee()
             if not committee.public_signing_keys:
                 return outcome.Error(
-                    storage.AccessError(f"No keys found for committee {self.__committee_key} to generate KEYS file.")
+                    storage.AccessError(
+                        f"No keys found for committee {self.__committee_key} to generate KEYS file.", status=404
+                    )
                 )
             synced_path = await self._sync_committee_keys_file(self.__committee_key)
         except Exception as e:
             return outcome.Error(e)
         if synced_path is None:
             return outcome.Error(
-                storage.AccessError(f"No keys found for committee {self.__committee_key} to generate KEYS file.")
+                storage.AccessError(
+                    f"No keys found for committee {self.__committee_key} to generate KEYS file.", status=404
+                )
             )
         return outcome.Result(synced_path)
 
     async def committee(self) -> sql.Committee:
         return await self.__data.committee(key=self.__committee_key, _public_signing_keys=True).demand(
-            storage.AccessError(f"Committee not found: {self.__committee_key}")
+            storage.AccessError(f"Committee not found: {self.__committee_key}", status=404)
         )
 
     @property
@@ -690,15 +699,16 @@ class CommitteeParticipant(FoundationCommitter):
             project_key=str(project_key),
             version=str(version_key),
             _committee=True,
-        ).demand(storage.AccessError(f"Release not found: {project_key} {version_key}"))
+        ).demand(storage.AccessError(f"Release not found: {project_key} {version_key}", status=404))
         keys_path = paths.release_directory(release) / "KEYS"
         async with aiofiles.open(keys_path, encoding="utf-8") as f:
             keys_file_text = await f.read()
         if release.committee is None:
-            raise storage.AccessError("No committee found for release - Invalid state")
+            raise storage.AccessError("No committee found for release - Invalid state", status=500)
         if release.committee.key != self.__committee_key:
             raise storage.AccessError(
-                f"Release {project_key!s} {version_key!s} is not associated with committee {self.__committee_key}"
+                f"Release {project_key!s} {version_key!s} is not associated with committee {self.__committee_key}",
+                status=403,
             )
 
         outcomes = await self.ensure_associated(keys_file_text)
@@ -890,7 +900,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -909,7 +919,7 @@ class FoundationAdmin(CommitteeMember):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -923,7 +933,9 @@ class FoundationAdmin(CommitteeMember):
         committee_query.query = committee_query.query.options(
             orm.selectinload(via(sql.Committee.public_signing_keys)).selectinload(via(sql.PublicSigningKey.committees))
         )
-        committee = await committee_query.demand(storage.AccessError(f"Committee not found: {self.__committee_key}"))
+        committee = await committee_query.demand(
+            storage.AccessError(f"Committee not found: {self.__committee_key}", status=404)
+        )
 
         keys_to_check = list(committee.public_signing_keys)
         if not keys_to_check:
diff --git a/atr/storage/writers/mail.py b/atr/storage/writers/mail.py
index 6f947410..71033a1d 100644
--- a/atr/storage/writers/mail.py
+++ b/atr/storage/writers/mail.py
@@ -58,7 +58,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def send(self, message: mail.Message, category: mail.MailFooterCategory) -> tuple[str, list[str]]:
@@ -99,7 +99,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -118,7 +118,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
diff --git a/atr/storage/writers/policy.py b/atr/storage/writers/policy.py
index 3a9e9cc0..30f47dea 100644
--- a/atr/storage/writers/policy.py
+++ b/atr/storage/writers/policy.py
@@ -69,7 +69,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -87,7 +87,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -106,7 +106,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -198,7 +198,7 @@ class CommitteeMember(CommitteeParticipant):
         project, release_policy = await self.__get_or_create_policy(project_key)
         vote_mode = form.vote_mode
         if (vote_mode == models.sql.VoteMode.MANUAL) and (project.committee and project.committee.is_podling):
-            raise storage.AccessError("Manual voting is not allowed for podlings.")
+            raise storage.AccessError("Manual voting is not allowed for podlings.", status=400)
 
         release_policy.vote_mode = vote_mode
 
@@ -226,7 +226,7 @@ class CommitteeMember(CommitteeParticipant):
     ) -> tuple[models.sql.Project, models.sql.ReleasePolicy]:
         project = await self.__data.project(
             key=str(project_key), status=models.sql.ProjectStatus.ACTIVE, _release_policy=True, _committee=True
-        ).demand(storage.AccessError(f"Project {project_key} not found"))
+        ).demand(storage.AccessError(f"Project {project_key} not found", status=404))
 
         release_policy = project.release_policy
         if release_policy is None:
@@ -293,7 +293,7 @@ class CommitteeMember(CommitteeParticipant):
             raise ValueError("Field 'manual_vote' does not accept null")
         if update.manual_vote:
             if project.committee and project.committee.is_podling:
-                raise storage.AccessError("Manual voting is not allowed for podlings.")
+                raise storage.AccessError("Manual voting is not allowed for podlings.", status=400)
             release_policy.vote_mode = models.sql.VoteMode.MANUAL
         else:
             release_policy.vote_mode = models.sql.VoteMode.EMAIL
diff --git a/atr/storage/writers/project.py b/atr/storage/writers/project.py
index fbe7681e..5488bb61 100644
--- a/atr/storage/writers/project.py
+++ b/atr/storage/writers/project.py
@@ -51,7 +51,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -69,7 +69,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -88,14 +88,14 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
     async def category_add(self, project_key: safe.ProjectKey, new_category: str) -> bool:
         project = await self.__data.project(key=str(project_key)).get()
         if not project:
-            raise storage.AccessError(f"Project '{project_key}' not found.")
+            raise storage.AccessError(f"Project '{project_key}' not found.", status=404)
         new_category = new_category.strip()
         current_categories = self.__current_categories(project)
         if new_category and (new_category not in current_categories):
@@ -120,7 +120,7 @@ class CommitteeMember(CommitteeParticipant):
     async def category_remove(self, project_key: safe.ProjectKey, action_value: str) -> bool:
         project = await self.__data.project(key=str(project_key)).get()
         if not project:
-            raise storage.AccessError(f"Project '{project_key}' not found.")
+            raise storage.AccessError(f"Project '{project_key}' not found.", status=404)
         current_categories = self.__current_categories(project)
         if action_value in current_categories:
             if action_value in registry.FORBIDDEN_PROJECT_CATEGORIES:
@@ -154,7 +154,7 @@ class CommitteeMember(CommitteeParticipant):
 
         # Check whether the project already exists
         if await self.__data.project(key=label).get():
-            raise storage.AccessError(f"Project {label} already exists")
+            raise storage.AccessError(f"Project {label} already exists", status=409)
 
         project = sql.Project(
             key=label,
@@ -186,7 +186,7 @@ class CommitteeMember(CommitteeParticipant):
                 and (e.orig.sqlite_errorcode == sqlite3.SQLITE_CONSTRAINT_PRIMARYKEY)
                 and ("project.key" in str(e.orig))
             ):
-                raise storage.AccessError(f"Project {label} already exists")
+                raise storage.AccessError(f"Project {label} already exists", status=409)
             else:
                 raise
 
@@ -196,11 +196,13 @@ class CommitteeMember(CommitteeParticipant):
         ).get()
 
         if not project:
-            raise storage.AccessError(f"Project '{project_key}' not found.")
+            raise storage.AccessError(f"Project '{project_key}' not found.", status=404)
 
         # Prevent deletion if there are associated releases or channels
         if project.releases:
-            raise storage.AccessError(f"Cannot delete project '{project_key}' because it has associated releases.")
+            raise storage.AccessError(
+                f"Cannot delete project '{project_key}' because it has associated releases.", status=409
+            )
 
         await self.__data.delete(project)
         await self.__data.commit()
@@ -213,7 +215,7 @@ class CommitteeMember(CommitteeParticipant):
     async def language_add(self, project_key: safe.ProjectKey, new_language: str) -> bool:
         project = await self.__data.project(key=str(project_key)).get()
         if not project:
-            raise storage.AccessError(f"Project '{project_key}' not found.")
+            raise storage.AccessError(f"Project '{project_key}' not found.", status=404)
         new_language = new_language.strip()
         current_languages = self.__current_languages(project)
         if new_language and (new_language not in current_languages):
@@ -236,7 +238,7 @@ class CommitteeMember(CommitteeParticipant):
     async def language_remove(self, project_key: safe.ProjectKey, action_value: str) -> bool:
         project = await self.__data.project(key=str(project_key)).get()
         if not project:
-            raise storage.AccessError(f"Project '{project_key}' not found.")
+            raise storage.AccessError(f"Project '{project_key}' not found.", status=404)
         current_languages = self.__current_languages(project)
         if action_value in current_languages:
             current_languages.remove(action_value)
diff --git a/atr/storage/writers/release.py b/atr/storage/writers/release.py
index 203d3e43..cc6c59bf 100644
--- a/atr/storage/writers/release.py
+++ b/atr/storage/writers/release.py
@@ -143,7 +143,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -161,7 +161,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -175,7 +175,7 @@ class CommitteeParticipant(FoundationCommitter):
         """Handle the deletion of database records and filesystem data for a release."""
         release = await self.__data.release(
             project_key=str(project_key), version=str(version), phase=phase, _committee=True
-        ).demand(storage.AccessError(f"Release '{project_key!s} {version!s}' not found."))
+        ).demand(storage.AccessError(f"Release '{project_key!s} {version!s}' not found.", status=404))
         release_dirs = [
             paths.release_directory_base(release),
             paths.get_attestable_dir() / str(project_key) / str(version),
@@ -290,7 +290,7 @@ class CommitteeParticipant(FoundationCommitter):
             if not await aiofiles.os.path.exists(path_in_new_revision):
                 # This indicates a potential severe issue with hard linking or logic
                 log.error(f"SEVERE ERROR! File {rel_path_to_delete} not found in new revision before deletion")
-                raise storage.AccessError("File to delete was not found in the new revision")
+                raise storage.AccessError("File to delete was not found in the new revision", status=500)
 
             # Check whether the file is an artifact
             if analysis.is_artifact(path_in_new_revision.path):
@@ -338,11 +338,11 @@ class CommitteeParticipant(FoundationCommitter):
             # Check that the source file exists in the new revision
             if not await aiofiles.os.path.exists(path_in_new_revision):
                 log.error(f"Source file {rel_path} not found in new revision for hash generation.")
-                raise storage.AccessError("Source file not found in the new revision.")
+                raise storage.AccessError("Source file not found in the new revision.", status=500)
 
             # Check that the hash file does not already exist in the new revision
             if await aiofiles.os.path.exists(hash_path_in_new_revision):
-                raise storage.AccessError("SHA512 file already exists")
+                raise storage.AccessError("SHA512 file already exists", status=409)
 
             if not await aiofiles.os.path.exists(signature_path_in_new_revision):
                 raise types.FailedError(
@@ -491,7 +491,7 @@ class CommitteeParticipant(FoundationCommitter):
     ) -> tuple[sql.Release, int, sql.VoteMode]:
         release_for_pre_checks = await self.__data.release(
             key=str(release_key), _project=True, _committee=True, _project_release_policy=True
-        ).demand(storage.AccessError("Release candidate draft not found"))
+        ).demand(storage.AccessError("Release candidate draft not found", status=404))
         project_key = release_for_pre_checks.safe_project_key
         version_key = release_for_pre_checks.safe_version_key
         revision_number = release_for_pre_checks.safe_latest_revision_number
@@ -500,15 +500,15 @@ class CommitteeParticipant(FoundationCommitter):
         else:
             vote_mode = release_for_pre_checks.vote_mode
             if vote_mode is None:
-                raise storage.AccessError("The release state has changed, please refresh and try again")
+                raise storage.AccessError("The release state has changed, please refresh and try again", status=409)
         if vote_mode not in allowed_vote_modes:
-            raise storage.AccessError("This release's vote mode does not allow that action")
+            raise storage.AccessError("This release's vote mode does not allow that action", status=409)
 
         # Check for ongoing tasks
         if promote:
             ongoing_tasks = await self.__tasks_ongoing(project_key, version_key, selected_revision_number)
             if ongoing_tasks > 0:
-                raise storage.AccessError("All checks must be completed before starting a vote")
+                raise storage.AccessError("All checks must be completed before starting a vote", status=409)
 
         # Verify that it's in the correct phase
         expected_phase = sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT
@@ -516,25 +516,28 @@ class CommitteeParticipant(FoundationCommitter):
             expected_phase = sql.ReleasePhase.RELEASE_CANDIDATE
         if release_for_pre_checks.phase != expected_phase:
             if promote:
-                raise storage.AccessError("This release is not in the candidate draft phase")
-            raise storage.AccessError("The release state has changed, please refresh and try again")
+                raise storage.AccessError("This release is not in the candidate draft phase", status=409)
+            raise storage.AccessError("The release state has changed, please refresh and try again", status=409)
 
         # Check that the revision number is the latest
         if revision_number != selected_revision_number:
-            raise storage.AccessError("The selected revision number does not match the latest revision number")
+            raise storage.AccessError(
+                "The selected revision number does not match the latest revision number", status=409
+            )
 
         if await interaction.has_blocker_checks(
             release_for_pre_checks, selected_revision_number, caller_data=self.__data
         ):
             raise storage.AccessError(
-                "This release candidate draft has blockers. Please fix the blockers before starting a vote."
+                "This release candidate draft has blockers. Please fix the blockers before starting a vote.",
+                status=409,
             )
 
         # Check that there is at least one file in the draft
         if promote:
             file_count = await util.number_of_release_files(release_for_pre_checks)
             if file_count == 0:
-                raise storage.AccessError("This candidate draft is empty, containing no files")
+                raise storage.AccessError("This candidate draft is empty, containing no files", status=400)
 
         # Promote it to RELEASE_CANDIDATE
         via = sql.validate_instrumented_attribute
@@ -560,9 +563,9 @@ class CommitteeParticipant(FoundationCommitter):
         result = await self.__data.execute(stmt.values(**values))
         if not isinstance(result, engine.CursorResult):
             log.error(f"Expected cursor result, got {type(result)}")
-            raise storage.AccessError("An error occurred while promoting the release candidate")
+            raise storage.AccessError("An error occurred while promoting the release candidate", status=500)
         if result.rowcount != 1:
-            raise storage.AccessError("A newer revision appeared, please refresh and try again.")
+            raise storage.AccessError("A newer revision appeared, please refresh and try again.", status=409)
         await self.__data.refresh(release_for_pre_checks)
         return release_for_pre_checks, vote_seq, vote_mode
 
@@ -610,7 +613,7 @@ class CommitteeParticipant(FoundationCommitter):
             key=str(project_key), status=sql.ProjectStatus.ACTIVE, _committee=True
         ).get()
         if not project:
-            raise storage.AccessError(f"Project {project_key} not found")
+            raise storage.AccessError(f"Project {project_key} not found", status=404)
 
         tests_allowed = config.is_test_mode()
         committee = project.committee
@@ -621,7 +624,8 @@ class CommitteeParticipant(FoundationCommitter):
             display_name = project.display_name
             if committee is None:
                 raise storage.AccessError(
-                    f"You must be a member or committer of the {display_name} committee to start a release draft."
+                    f"You must be a member or committer of the {display_name} committee to start a release draft.",
+                    status=403,
                 )
 
             is_committee_member = self.__asf_uid in committee.committee_members
@@ -630,7 +634,8 @@ class CommitteeParticipant(FoundationCommitter):
 
             if not has_committee_access:
                 raise storage.AccessError(
-                    f"You must be a member or committer of the {display_name} committee to start a release draft."
+                    f"You must be a member or committer of the {display_name} committee to start a release draft.",
+                    status=403,
                 )
 
         # TODO: Consider using Release.revision instead of ./latest
@@ -645,13 +650,13 @@ class CommitteeParticipant(FoundationCommitter):
                     phase_desc = "A release preview (being finished)"
                 case sql.ReleasePhase.RELEASE:
                     phase_desc = "A finished release"
-            raise storage.AccessError(f"{phase_desc} for {project_key!s} {version} already exists.")
+            raise storage.AccessError(f"{phase_desc} for {project_key!s} {version} already exists.", status=409)
 
         # Validate the version name
         # TODO: We should check that it's bigger than the current version
         # We have the packaging library as a dependency, but it is Python specific
         if version_key_error := util.version_key_error(str(version)):
-            raise storage.AccessError(f'Invalid version name "{version!s}": {version_key_error}')
+            raise storage.AccessError(f'Invalid version name "{version!s}": {version_key_error}', status=400)
         release = sql.Release(
             phase=sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT,
             project_key=project.key,
@@ -705,7 +710,7 @@ class CommitteeParticipant(FoundationCommitter):
             return await data.revision(
                 release_key=str(release_key),
                 number=result.number,
-            ).demand(storage.AccessError("Revision not found"))
+            ).demand(storage.AccessError("Revision not found", status=404))
 
     async def upload_files(
         self,
@@ -720,7 +725,7 @@ class CommitteeParticipant(FoundationCommitter):
         async def modify(path: safe.StatePath, _old_rev: sql.Revision | None) -> None:
             for file in files:
                 if not file.filename:
-                    raise storage.AccessError("No filename provided")
+                    raise storage.AccessError("No filename provided", status=400)
                 # Validate the filename from multipart upload and construct the new path
                 target_path = path / str(safe.RelPath(file.filename))
                 await aiofiles.os.makedirs(target_path.parent, exist_ok=True)
@@ -1005,7 +1010,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -1018,5 +1023,5 @@ class FoundationAdmin(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
diff --git a/atr/storage/writers/revision.py b/atr/storage/writers/revision.py
index 8ba023ed..8b16b389 100644
--- a/atr/storage/writers/revision.py
+++ b/atr/storage/writers/revision.py
@@ -366,7 +366,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -384,7 +384,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -601,11 +601,13 @@ class CommitteeParticipant(FoundationCommitter):
     ) -> None:
         tag = tag.strip()
         if not tag:
-            raise storage.AccessError("Tag is required")
+            raise storage.AccessError("Tag is required", status=400)
         if re.match(r"^[a-zA-Z0-9+_.-]+$", tag) is None:
-            raise storage.AccessError("Tag must contain only letters, numbers, plus, underscore, dot, or hyphen")
+            raise storage.AccessError(
+                "Tag must contain only letters, numbers, plus, underscore, dot, or hyphen", status=400
+            )
         if len(tag.encode("utf-8")) > 256:
-            raise storage.AccessError("Tag must be at most 256 bytes")
+            raise storage.AccessError("Tag must be at most 256 bytes", status=400)
 
         release_key = sql.release_key(str(project_key), str(version_key))
         via = sql.validate_instrumented_attribute
@@ -624,7 +626,7 @@ class CommitteeParticipant(FoundationCommitter):
             revision = await self.__data.revision(release_key=release_key, number=revision_number).get()
             if revision is None:
                 raise base.ASFQuartException(f"Revision {revision_number} not found", errorcode=404)
-            raise storage.AccessError(f"Revision {revision_number} already has a tag and cannot be changed")
+            raise storage.AccessError(f"Revision {revision_number} already has a tag and cannot be changed", status=409)
         await self.__data.commit()
         self.__write_as.append_to_audit_log(
             asf_uid=self.__asf_uid,
@@ -721,6 +723,6 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
diff --git a/atr/storage/writers/sbom.py b/atr/storage/writers/sbom.py
index 0e2e16ed..60b38965 100644
--- a/atr/storage/writers/sbom.py
+++ b/atr/storage/writers/sbom.py
@@ -50,7 +50,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
 
@@ -68,7 +68,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -202,7 +202,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
diff --git a/atr/storage/writers/ssh.py b/atr/storage/writers/ssh.py
index 620a2265..05a7cb3e 100644
--- a/atr/storage/writers/ssh.py
+++ b/atr/storage/writers/ssh.py
@@ -52,7 +52,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def add_key(self, key: str) -> str:
@@ -65,7 +65,7 @@ class FoundationCommitter(GeneralPublic):
         ssh_key = await self.__data.ssh_key(
             fingerprint=fingerprint,
             asf_uid=self.__asf_uid,
-        ).demand(storage.AccessError(f"Key not found: {fingerprint}"))
+        ).demand(storage.AccessError(f"Key not found: {fingerprint}", status=404))
         await self.__data.delete(ssh_key)
         await self.__data.commit()
         message = mail.Message(
@@ -92,7 +92,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -148,7 +148,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -166,7 +166,7 @@ class FoundationAdmin(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def revoke_all_user_keys(self, target_asf_uid: str) -> tuple[int, int]:
diff --git a/atr/storage/writers/tokens.py b/atr/storage/writers/tokens.py
index f0a93409..06f07cdd 100644
--- a/atr/storage/writers/tokens.py
+++ b/atr/storage/writers/tokens.py
@@ -55,7 +55,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def add_token(
@@ -125,13 +125,13 @@ class FoundationCommitter(GeneralPublic):
                     "reason": "invalid_or_expired_pat",
                 },
             )
-            raise storage.AccessError("Authentication failed")
+            raise storage.AccessError("Authentication failed", status=401)
 
         # Verify account still exists in LDAP
         account_details = await ldap.account_lookup(self.__asf_uid)
         if (account_details is None) or ldap.is_banned(account_details):
             log.auth_failure("jwt_issuance", "account_deleted_or_banned", self.__asf_uid)
-            raise storage.AccessError("Authentication failed")
+            raise storage.AccessError("Authentication failed", status=401)
 
         issued_jwt = jwtoken.issue(self.__asf_uid, pat_hash=pat_hash)
         log.auth_event("jwt_issued", self.__asf_uid, pat_hash=pat_hash)
@@ -158,7 +158,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -177,7 +177,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -195,7 +195,7 @@ class FoundationAdmin(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def revoke_all_user_tokens(self, target_asf_uid: str) -> int:
diff --git a/atr/storage/writers/user.py b/atr/storage/writers/user.py
index 238d0be6..37cf977a 100644
--- a/atr/storage/writers/user.py
+++ b/atr/storage/writers/user.py
@@ -46,7 +46,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def set_user_preferences(self, preferences: sql.UserPreferencesEntry):
@@ -76,7 +76,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -95,7 +95,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -114,6 +114,6 @@ class FoundationAdmin(CommitteeMember):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
diff --git a/atr/storage/writers/vote.py b/atr/storage/writers/vote.py
index 2ff542bd..9daf3d7e 100644
--- a/atr/storage/writers/vote.py
+++ b/atr/storage/writers/vote.py
@@ -59,7 +59,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     async def cast_trusted(  # noqa: C901
@@ -222,7 +222,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -331,7 +331,7 @@ class CommitteeParticipant(FoundationCommitter):
                         version=str(version_key),
                         _project=True,
                         _committee=True,
-                    ).demand(storage.AccessError("Release not found"))
+                    ).demand(storage.AccessError("Release not found", status=404))
                 release, vote_seq, vote_mode = await self.__write_as.release._start_vote_no_commit(
                     release.safe_key,
                     selected_revision_number,
@@ -340,7 +340,7 @@ class CommitteeParticipant(FoundationCommitter):
                     expected_podling_thread_id=release.podling_thread_id,
                 )
             if release.committee is None:
-                raise storage.AccessError("Release has no committee")
+                raise storage.AccessError("Release has no committee", status=500)
             if permitted_recipients is None:
                 permitted_recipients = util.permitted_podling_first_round_recipients(
                     self.__asf_uid,
@@ -352,7 +352,7 @@ class CommitteeParticipant(FoundationCommitter):
                 if addr not in permitted_recipients:
                     # This will be checked again by tasks/vote.py for extra safety
                     log.info(f"Invalid mailing list choice: {addr} not in {permitted_recipients}")
-                    raise storage.AccessError("Invalid mailing list choice")
+                    raise storage.AccessError("Invalid mailing list choice", status=403)
 
             if second_round_email_to is not None:
                 second_round_permitted = util.permitted_podling_second_round_recipients(self.__asf_uid)
@@ -361,7 +361,7 @@ class CommitteeParticipant(FoundationCommitter):
                         "Invalid second round mailing list choice: "
                         f"{second_round_email_to} not in {second_round_permitted}"
                     )
-                    raise storage.AccessError("Invalid second round mailing list choice")
+                    raise storage.AccessError("Second round mailing list choice is not permitted", status=403)
 
             # TODO: We also need to store the duration of the vote
             # We can't allow resolution of the vote until the duration has elapsed
@@ -428,7 +428,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -449,11 +449,11 @@ class CommitteeMember(CommitteeParticipant):
             _committee=True,
             _release_policy=True,
             _project_release_policy=True,
-        ).demand(storage.AccessError("Release not found"))
+        ).demand(storage.AccessError("Release not found", status=404))
         if (expected_vote_mode is not None) and (release.effective_vote_mode != expected_vote_mode):
-            raise storage.AccessError("The resolve form is stale, please refresh and try again")
+            raise storage.AccessError("The resolve form is stale, please refresh and try again", status=409)
         if release.effective_vote_mode == sql.VoteMode.MANUAL:
-            raise storage.AccessError("Release is configured for manual voting")
+            raise storage.AccessError("Release is configured for manual voting", status=409)
         podling_round_one_thread_id = None
         if release.effective_vote_mode == sql.VoteMode.TRUSTED:
             if (
@@ -485,7 +485,7 @@ class CommitteeMember(CommitteeParticipant):
             and (release.current_vote_seq is not None)
             and (release.current_vote_seq != expected_vote_seq)
         ):
-            raise storage.AccessError("The resolve form is stale, please refresh and try again")
+            raise storage.AccessError("The resolve form is stale, please refresh and try again", status=409)
 
         is_podling = False
         if release.project.committee is not None:
@@ -494,7 +494,7 @@ class CommitteeMember(CommitteeParticipant):
 
         latest_vote_task = await interaction.release_current_vote_task(release)
         if latest_vote_task is None:
-            raise storage.AccessError("No vote task found, unable to send resolution message.")
+            raise storage.AccessError("No vote task found, unable to send resolution message.", status=404)
 
         if (
             (vote_result != "cancelled")
@@ -502,14 +502,15 @@ class CommitteeMember(CommitteeParticipant):
             and (not interaction.vote_duration_bypass())
         ):
             raise storage.AccessError(
-                "The vote cannot be resolved before the voting period has ended unless it is cancelled."
+                "The vote cannot be resolved before the voting period has ended unless it is cancelled.",
+                status=409,
             )
 
         voting_round = None
         if is_podling is True:
             voting_round = 1 if (podling_thread_id is None) else 2
         if release.committee is None:
-            raise storage.AccessError("Project has no committee - Invalid state")
+            raise storage.AccessError("Project has no committee - Invalid state", status=500)
 
         return await self.resolve_release(
             project_key,
@@ -534,16 +535,16 @@ class CommitteeMember(CommitteeParticipant):
             _committee=True,
             _release_policy=True,
             _project_release_policy=True,
-        ).demand(storage.AccessError("Release not found"))
+        ).demand(storage.AccessError("Release not found", status=404))
 
         if release.effective_vote_mode != sql.VoteMode.MANUAL:
-            raise storage.AccessError("Release is not configured for manual voting")
+            raise storage.AccessError("Release is not configured for manual voting", status=409)
 
         if release.vote_started is None:
-            raise storage.AccessError("Vote has not been started")
+            raise storage.AccessError("Vote has not been started", status=409)
 
         if (release.project.committee is not None) and release.project.committee.is_podling:
-            raise storage.AccessError("Podling releases require the standard two round vote process")
+            raise storage.AccessError("Podling releases require the standard two round vote process", status=409)
 
         match vote_result:
             case "passed":
@@ -621,7 +622,7 @@ class CommitteeMember(CommitteeParticipant):
                 task_recipient = interaction.task_recipient_get(latest_vote_task)
                 archive_url = await self.__write_as.cache.get_message_archive_url(task_mid, task_recipient)
                 if archive_url is None:
-                    raise ValueError("No archive URL found for podling vote")
+                    raise storage.AccessError("No archive URL found for podling vote", status=404)
                 thread_id = archive_url.split("/")[-1]
                 await self._resolve_transition(
                     release,
@@ -637,10 +638,10 @@ class CommitteeMember(CommitteeParticipant):
                     latest_vote_task.task_args.get("second_round_email_to") or util.INCUBATOR_GENERAL_ADDRESS
                 )
                 if not release.project.committee:
-                    raise ValueError("Project has no committee - Invalid state")
+                    raise storage.AccessError("Project has no committee - Invalid state", status=500)
                 revision_number = release.latest_revision_number
                 if revision_number is None:
-                    raise ValueError("Release has no revision number - Invalid state")
+                    raise storage.AccessError("Release has no revision number - Invalid state", status=500)
                 vote_duration = latest_vote_task.task_args["vote_duration"]
                 subject_template = await construct.start_vote_subject_default(release.safe_project_key)
                 body_template = await construct.start_vote_default(release.safe_project_key)
@@ -670,7 +671,7 @@ class CommitteeMember(CommitteeParticipant):
                 )
                 second_round_vote_seq = second_round_task.task_args["vote_seq"]
                 if not isinstance(second_round_vote_seq, int):
-                    raise ValueError("Second round vote sequence is invalid")
+                    raise storage.AccessError("Second round vote sequence is invalid", status=500)
                 second_round_vote_mode = release.effective_vote_mode
                 await self.__data.commit()
                 await self.__data.refresh(release)
@@ -855,17 +856,17 @@ class CommitteeMember(CommitteeParticipant):
                 _committee=True,
                 _release_policy=True,
                 _project_release_policy=True,
-            ).demand(storage.AccessError("Release not found"))
+            ).demand(storage.AccessError("Release not found", status=404))
             if (expected_vote_mode is not None) and (expected_vote_mode != sql.VoteMode.TRUSTED):
-                raise storage.AccessError("The resolve form is stale, please refresh and try again")
+                raise storage.AccessError("The resolve form is stale, please refresh and try again", status=409)
             if release.effective_vote_mode != sql.VoteMode.TRUSTED:
-                raise storage.AccessError("Release is not configured for trusted voting")
+                raise storage.AccessError("Release is not configured for trusted voting", status=409)
             if release.current_vote_seq is None:
-                raise storage.AccessError("Vote serial is missing, please refresh and try again")
+                raise storage.AccessError("Vote serial is missing, please refresh and try again", status=409)
             if (expected_vote_seq is not None) and (release.current_vote_seq != expected_vote_seq):
-                raise storage.AccessError("The resolve form is stale, please refresh and try again")
+                raise storage.AccessError("The resolve form is stale, please refresh and try again", status=409)
             if release.committee is None:
-                raise storage.AccessError("Project has no committee - Invalid state")
+                raise storage.AccessError("Project has no committee - Invalid state", status=500)
 
             vote_seq = release.current_vote_seq
             voting_round = None
@@ -882,7 +883,8 @@ class CommitteeMember(CommitteeParticipant):
                 and (not resolution_bypass)
             ):
                 raise storage.AccessError(
-                    "The vote cannot be resolved before the voting period has ended unless it is cancelled."
+                    "The vote cannot be resolved before the voting period has ended unless it is cancelled.",
+                    status=409,
                 )
 
             ballots = await interaction.ballots_for_resolution(release.key, vote_seq, self.__data)
@@ -894,14 +896,15 @@ class CommitteeMember(CommitteeParticipant):
             ):
                 binding_label, _non_binding_label = user.binding_terminology(voting_round)
                 raise storage.AccessError(
-                    f"The trusted ballot record does not have enough {binding_label.lower()} +1 votes to pass."
+                    f"The trusted ballot record does not have enough {binding_label.lower()} +1 votes to pass.",
+                    status=409,
                 )
 
             if (voting_round == 1) and (vote_result == "passed"):
                 if latest_vote_task is None:
-                    raise storage.AccessError("No vote task found, unable to start the Incubator vote.")
+                    raise storage.AccessError("No vote task found, unable to start the Incubator vote.", status=404)
                 if podling_round_one_thread_id is None:
-                    raise storage.AccessError("No archive URL found for podling vote")
+                    raise storage.AccessError("No archive URL found for podling vote", status=404)
                 await self._resolve_transition(
                     release,
                     expected_phase=sql.ReleasePhase.RELEASE_CANDIDATE,
@@ -917,7 +920,7 @@ class CommitteeMember(CommitteeParticipant):
                 )
                 revision_number = release.latest_revision_number
                 if revision_number is None:
-                    raise storage.AccessError("Release has no revision number - Invalid state")
+                    raise storage.AccessError("Release has no revision number - Invalid state", status=500)
                 vote_duration = latest_vote_task.task_args["vote_duration"]
                 subject_template = await construct.start_vote_subject_default(release.safe_project_key)
                 body_template = await construct.start_vote_default(release.safe_project_key)
@@ -947,7 +950,7 @@ class CommitteeMember(CommitteeParticipant):
                 )
                 second_round_vote_seq = second_round_task.task_args["vote_seq"]
                 if not isinstance(second_round_vote_seq, int):
-                    raise storage.AccessError("Second round vote sequence is invalid")
+                    raise storage.AccessError("Second round vote sequence is invalid", status=500)
                 second_round_vote_mode = release.effective_vote_mode
                 await self.__data.commit()
                 await self.__data.refresh(release)
@@ -1064,7 +1067,7 @@ class CommitteeMember(CommitteeParticipant):
         )
         if getattr(result, "rowcount", 0) != 1:
             await self.__data.rollback()
-            raise storage.AccessError("The release state has changed, please refresh and try again")
+            raise storage.AccessError("The release state has changed, please refresh and try again", status=409)
 
     # def __committee_member_or_admin(self, committee: sql.Committee, asf_uid: str) -> None:
     #     if not (user.is_committee_member(committee, asf_uid) or user.is_admin(asf_uid)):
diff --git a/atr/storage/writers/workflowstatus.py b/atr/storage/writers/workflowstatus.py
index 73a289da..cda163b7 100644
--- a/atr/storage/writers/workflowstatus.py
+++ b/atr/storage/writers/workflowstatus.py
@@ -45,7 +45,7 @@ class FoundationCommitter(GeneralPublic):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
 
     # async def add_key(self, key: str, asf_uid: str) -> str:
@@ -77,7 +77,7 @@ class CommitteeParticipant(FoundationCommitter):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
@@ -96,7 +96,7 @@ class CommitteeMember(CommitteeParticipant):
         self.__data = data
         asf_uid = write.authorisation.asf_uid
         if asf_uid is None:
-            raise storage.AccessError("Not authorized")
+            raise storage.AccessError("Not authorized", status=403)
         self.__asf_uid = asf_uid
         self.__committee_key = committee_key
 
diff --git a/tests/unit/test_upload_json.py b/tests/unit/test_upload_json.py
index 9a4e31c8..72e061d6 100644
--- a/tests/unit/test_upload_json.py
+++ b/tests/unit/test_upload_json.py
@@ -38,9 +38,9 @@ async def test_add_files_html_redirect_on_success(app):
     session = mock.AsyncMock()
     session.redirect = mock.AsyncMock(return_value=redirect_response)
 
-    patched = _mock_storage(None, 2, False)
+    storage_write = _mock_storage_write(None, 2, False)
 
-    with mock.patch.object(upload, "storage", patched):
+    with mock.patch.object(upload.storage, "write", storage_write):
         async with app.test_request_context("/upload/test/1.0"):
             result = await upload._add_files(
                 session,
@@ -56,9 +56,9 @@ async def test_add_files_html_redirect_on_success(app):
 
 @pytest.mark.asyncio
 async def test_add_files_json_creation_error(app):
-    patched = _mock_storage("No files provided", 0, False)
+    storage_write = _mock_storage_write("No files provided", 0, False)
 
-    with mock.patch.object(upload, "storage", patched):
+    with mock.patch.object(upload.storage, "write", storage_write):
         async with app.test_request_context("/upload/test/1.0"):
             result = await upload._add_files(
                 mock.AsyncMock(),
@@ -77,10 +77,10 @@ async def test_add_files_json_creation_error(app):
 
 @pytest.mark.asyncio
 async def test_add_files_json_success(app):
-    patched = _mock_storage(None, 2, False)
+    storage_write = _mock_storage_write(None, 2, False)
 
     with (
-        mock.patch.object(upload, "storage", patched),
+        mock.patch.object(upload.storage, "write", storage_write),
         mock.patch.object(upload.util, "as_url", return_value="/compose/test/1.0"),
     ):
         async with app.test_request_context("/upload/test/1.0"):
@@ -100,7 +100,7 @@ async def test_add_files_json_success(app):
     assert "2 files" in data["message"]
 
 
-def _mock_storage(creation_error, number_of_files, was_quarantined):
+def _mock_storage_write(creation_error, number_of_files, was_quarantined):
     wacp = mock.AsyncMock()
     wacp.release.upload_files = mock.AsyncMock(
         return_value=(creation_error, number_of_files, was_quarantined),
@@ -111,4 +111,4 @@ def _mock_storage(creation_error, number_of_files, was_quarantined):
     cm = mock.AsyncMock()
     cm.__aenter__.return_value = write
 
-    return mock.MagicMock(write=mock.MagicMock(return_value=cm))
+    return mock.MagicMock(return_value=cm)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org