babalae/better-genshin-impact · warning · NotifierException
OneBot endpoint is not set
Error message
OneBot endpoint is not set
What it means
OneBotNotifier.SendAsync fails fast when the Endpoint property (the OneBot HTTP API base URL, e.g. http://127.0.0.1:5700) is null or empty. Without it the notifier cannot build the /send_msg URL.
Source
Thrown at BetterGenshinImpact/Service/Notifier/OneBotNotifier.cs:42
public string Token { get; set; }
private readonly HttpClient _httpClient;
public OneBotNotifier(HttpClient httpClient, string endpoint = "", string userId = "", string groupId = "", string token = "")
{
_httpClient = httpClient;
Endpoint = endpoint;
UserId = userId;
GroupId = groupId;
Token = token;
}
public async Task SendAsync(BaseNotificationData content)
{
if (string.IsNullOrEmpty(Endpoint))
{
throw new NotifierException("OneBot endpoint is not set");
}
if (string.IsNullOrEmpty(UserId) && string.IsNullOrEmpty(GroupId))
{
throw new NotifierException("OneBot requires either a user ID or group ID");
}
try
{
// 确保URL以/send_msg结尾
var url = Endpoint.TrimEnd('/');
if (!url.EndsWith("/send_msg"))
{
url += "/send_msg";
}
bool success = true;
View on GitHub (pinned to a7cb36712d)
Solutions
- Set the OneBot HTTP endpoint in settings (e.g. http://127.0.0.1:5700) and ensure the OneBot client has HTTP POST enabled.
- Validate the endpoint is a reachable absolute URL before constructing the notifier.
- Confirm the OneBot framework's http config host/port matches what was entered.
Example fix
// before
var n = new OneBotNotifier(httpClient, endpoint, userId, groupId, token);
// after
if (!Uri.TryCreate(endpoint, UriKind.Absolute, out _))
throw new InvalidOperationException("OneBot endpoint must be an absolute URL.");
var n = new OneBotNotifier(httpClient, endpoint, userId, groupId, token); Defensive patterns
Strategy: validation
Validate before calling
if (!Uri.TryCreate(endpoint, UriKind.Absolute, out var uri)
|| (uri.Scheme != "http" && uri.Scheme != "https"))
throw new InvalidOperationException("OneBot endpoint must be an absolute http(s) URL."); Type guard
static bool IsOneBotEndpointValid(string endpoint)
=> Uri.TryCreate(endpoint, UriKind.Absolute, out var u)
&& (u.Scheme == Uri.UriSchemeHttp || u.Scheme == Uri.UriSchemeHttps); Try / catch
try { await oneBotNotifier.SendAsync(data); }
catch (NotifierException ex) when (ex.Message.Contains("endpoint is not set"))
{ /* prompt user to configure endpoint, no retry */ } Prevention
- Validate the endpoint URL at settings-save time.
- Confirm the OneBot framework's HTTP server is enabled on that host:port.
When it happens
Trigger: OneBotNotifier constructed with endpoint="" (the default) and SendAsync invoked; the IsNullOrEmpty(Endpoint) guard at line 40 fires.
Common situations: User enabled the OneBot channel without configuring the reverse-HTTP endpoint URL; settings string was trimmed to empty; the OneBot implementation (go-cqhttp, NapCat, Lagrange) is not running or moved port.
Related errors
- OneBot requires either a user ID or group ID
- MeoW 昵称为空
- ServerChan SendKey为空
- Invalid key format for sctp.
- Invalid Telegram proxy URL format: {proxyUrl}. Details: {ex.
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/466f25890dd9e365.
Report an issue: GitHub.