From 2d19849e7abc1a2600f55f348f2f0d7901387981 Mon Sep 17 00:00:00 2001 From: Perside Rosalie Date: Fri, 27 Feb 2026 05:45:36 +0100 Subject: [PATCH] Prevent unclear Elasticsearch alias update failures when response is malformed Add explicit check for missing "acknowledged" key in Elasticsearch response Bug: T418143 --- app/Jobs/ElasticSearchAliasInit.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Jobs/ElasticSearchAliasInit.php b/app/Jobs/ElasticSearchAliasInit.php index 3fdfb2ae..784dabea 100644 --- a/app/Jobs/ElasticSearchAliasInit.php +++ b/app/Jobs/ElasticSearchAliasInit.php @@ -112,6 +112,14 @@ public function handle(HttpRequest $request) { } $json = json_decode($rawResponse, true); + if (!array_key_exists('acknowledged', $json)) { + Log::error("Missing 'acknowledged' key. Are the shared indices set up properly?"); + $this->fail( + new \RuntimeException("Updating Elasticsearch aliases failed for $this->wikiId with $rawResponse") + ); + + return; + } if ($json['acknowledged'] !== true) { Log::error(__METHOD__ . ": Updating Elasticsearch aliases failed for $this->wikiId with $rawResponse"); $this->fail(