From 17abea488b86c88e16b13e78c60cf4caa5526e44 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 26 May 2026 03:21:05 +0000 Subject: [PATCH] fix: skip 4xx typed exceptions in VCS deployments instead of 500ing Typed Appwrite exceptions thrown inside the per-repository loop in createGitDeployments (PROJECT_NOT_FOUND, PROVIDER_REPOSITORY_NOT_FOUND, TEAM_NOT_FOUND, TEAM_READ_ONLY, LIMIT_OUTSTANDING_INVOICE, GENERAL_RESOURCE_BLOCKED, etc.) were caught by a blanket \Throwable handler, collected into $errors, and re-thrown after the loop as GENERAL_UNKNOWN (HTTP 500), triggering false Sentry alerts on legitimate 4xx conditions like stale repositories and billing read-only teams. Catch typed Exception separately: when getCode() < 500 (client error), log a warning, record the type in the span, and skip the repository. Unexpected 5xx-and-above and unknown \Throwable errors still bubble up as GENERAL_UNKNOWN. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../Platform/Modules/VCS/Http/GitHub/Deployment.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php index 27c4eacba3..cde39e9292 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php @@ -578,6 +578,14 @@ trait Deployment Span::add("{$logBase}.build.triggered", 'true'); //TODO: Add event? + } catch (Exception $e) { + Span::add("{$logBase}.error", $e->getMessage()); + Span::add("{$logBase}.error.type", $e->getType()); + if ($e->getCode() < 500) { + Console::warning("Skipping repository '{$repository->getId()}' ({$e->getType()}): {$e->getMessage()}"); + continue; + } + $errors[] = $e->getMessage(); } catch (\Throwable $e) { Span::add("{$logBase}.error", $e->getMessage()); $errors[] = $e->getMessage();