netchx/netch · warning · Exception
{item.Remark} Response Status Code: {code}
Error message
{item.Remark} Response Status Code: {code} What it means
During subscription update, UpdateServerCoreAsync issues the HTTP request and throws if the status is anything other than 200 OK, embedding the subscription Remark and the returned HttpStatusCode. The exception is caught by the surrounding try/catch in the same method: it shows a NotifyTip and logs a warning, so the application continues and other subscriptions still update (UpdateServersAsync uses Task.WhenAll per item). Non-200 covers auth failures (401/403), not-found (404), server errors (5xx), and rate-limiting (429).
Source
Thrown at Netch/Utils/SubscriptionUtil.cs:36
{
if (!item.Enable)
return;
var request = WebUtil.CreateRequest(item.Link);
if (!string.IsNullOrEmpty(item.UserAgent))
request.UserAgent = item.UserAgent;
if (!string.IsNullOrEmpty(proxyServer))
request.Proxy = new WebProxy(proxyServer);
List<Server> servers;
var (code, result) = await WebUtil.DownloadStringAsync(request);
if (code == HttpStatusCode.OK)
servers = ShareLink.ParseText(result);
else
throw new Exception($"{item.Remark} Response Status Code: {code}");
foreach (var server in servers)
server.Group = item.Remark;
lock (ServerLock)
{
Global.Settings.Server.RemoveAll(server => server.Group.Equals(item.Remark));
Global.Settings.Server.AddRange(servers);
}
Global.MainForm.NotifyTip(i18N.TranslateFormat("Update {1} server(s) from {0}", item.Remark, servers.Count));
}
catch (Exception e)
{
Global.MainForm.NotifyTip($"{i18N.TranslateFormat("Update servers failed from {0}", item.Remark)}\n{e.Message}", info: false);
Log.Warning(e, "Update servers failed");
}
}View on GitHub (pinned to 9d99eb1c5a)
Solutions
- Open the subscription URL in a browser to confirm what it returns.
- Update the subscription Link in settings to the current URL.
- If auth is required, append the token/parameter the provider documents.
- For 429/5xx, retry after a short delay (transient).
- Set a realistic item.UserAgent if the provider blocks the default client.
Example fix
// before
if (code == HttpStatusCode.OK)
servers = ShareLink.ParseText(result);
else
throw new Exception($"{item.Remark} Response Status Code: {code}");
// after - distinguish transient from permanent status codes
if (code == HttpStatusCode.OK)
servers = ShareLink.ParseText(result);
else if (code == HttpStatusCode.TooManyRequests || (int)code >= 500)
throw new TransientSubscriptionException($"{item.Remark} transient {code}");
else
throw new SubscriptionException($"{item.Remark} permanent {code}"); Defensive patterns
Strategy: retry
Validate before calling
// Pre-check reachability and surface a clear message before the bulk update
var (code, _) = await WebUtil.DownloadStringAsync(WebUtil.CreateRequest(item.Link));
if (code != HttpStatusCode.OK)
Global.MainForm.NotifyTip($"{item.Remark} returned {code}; check the subscription link."); Try / catch
int attempt = 0;
Retry:
try { await UpdateServerCoreAsync(item, proxyServer); }
catch (Exception ex) when (attempt++ < 3 && (ex.Message.Contains("429") || ex.Message.Contains("50")))
{
await Task.Delay(TimeSpan.FromSeconds(5 * attempt));
goto Retry;
}
catch (Exception e)
{
Global.MainForm.NotifyTip($"Update servers failed from {item.Remark}\n{e.Message}", info: false);
Log.Warning(e, "Update servers failed");
} Prevention
- Distinguish transient (5xx/429) from permanent (4xx) status codes; only retry transient ones.
- Set item.UserAgent to a browser-like value if the provider blocks default clients.
- Validate the subscription Link is reachable on add/edit with a quick HEAD request.
- Surface the specific status code to the user (already done) so they can act.
- Keep updates per-item so one failing subscription does not block others (UpdateServersAsync already uses Task.WhenAll per item).
When it happens
Trigger: Subscription URL returns non-200: expired/changed link (404), token required (401/403), upstream server error (500/502/503), rate limit (429), or a CDN/Cloudflare challenge page. A redirect to an HTML error page can also surface here.
Common situations: Subscription provider rotated the URL; auth token expired; temporary provider outage; Cloudflare WAF blocking Netch's default User-Agent; provider returning HTML on error instead of server links.
Related errors
- Lookup Server hostname failed
- The {0} port is in use.
- The {0} port is used by {1}.
- Download Update File Failed: {e1.Message}
- GetBestRoute 搜索失败
AI-assisted analysis of netchx/netch@9d99eb1c5a (2026-08-13).
Data as JSON: /api/errors/11fbec58e4eb0d45.
Report an issue: GitHub.