flarum/framework · error · RuntimeException
Unexpected response from discuss.flarum.org.
Error message
Unexpected response from discuss.flarum.org.
What it means
Response-validation error in AnnouncementsFetcher::fetch: the HTTP request to discuss.flarum.org succeeded at the transport level, but the response was not the expected JSON announcement feed (unexpected status, wrong content type, or malformed body), so the fetcher rejects it rather than parsing garbage. Generic guard on the remote API response.
Solutions
- Inspect the actual response body/status from discuss.flarum.org (may be a 5xx or an HTML error page from a proxy/CDN).
- Retry later; the remote API may be temporarily degraded.
- Cache the last good announcements payload and serve it as a fallback.
- Verify no outbound proxy is rewriting the response.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at framework/core/src/Announcements/AnnouncementsFetcher.php:83 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15).
Data as JSON: /api/errors/8fa966f5fc3d6692.
Report an issue: GitHub.
Appendix: source
Thrown at framework/core/src/Announcements/AnnouncementsFetcher.php:83
]);
try {
$response = $this->client->get($url, [
'headers' => [
'Accept' => 'application/json',
'User-Agent' => 'Flarum/'.Application::VERSION
.' PHP/'.$this->appInfo->identifyPHPVersion()
.' Database/'.$this->appInfo->identifyDatabaseDriver().'/'.$this->appInfo->identifyDatabaseVersion(),
],
]);
} catch (GuzzleException $e) {
throw new RuntimeException('Could not fetch announcements from discuss.flarum.org: '.$e->getMessage(), 0, $e);
}
$body = json_decode((string) $response->getBody(), true);
if (! is_array($body['data'] ?? null)) {
throw new RuntimeException('Unexpected response from discuss.flarum.org.');
}
$posts = [];
$users = [];
$tagSlugs = [];
foreach ($body['included'] ?? [] as $resource) {
if (Arr::get($resource, 'type') === 'posts') {
$posts[$resource['id']] = $resource;
} elseif (Arr::get($resource, 'type') === 'users') {
$users[$resource['id']] = $resource;
} elseif (Arr::get($resource, 'type') === 'tags') {
$tagSlugs[$resource['id']] = Arr::get($resource, 'attributes.slug');
}
}
$items = [];
foreach ($body['data'] as $discussion) {
$id = Arr::get($discussion, 'id');View on GitHub (pinned to 4b939f6853)