JustArchiNET/ArchiSteamFarm · error · NLogConfigurationException
SteamID is invalid!
Error message
SteamID is invalid!
What it means
Thrown during SteamTarget.InitializeTarget() (an NLog custom target). NLog calls this when the target starts; ASF validates that SteamID is a real, individual Steam account ID (and that a group target, if ChatGroupID==0, is not being misconfigured). An invalid setup raises NLogConfigurationException. This is NLog-configuration-time validation, not a runtime log call.
Source
Thrown at ArchiSteamFarm/NLog/Targets/SteamTarget.cs:62
// This is NLog config property, it must have public get() and set() capabilities
[UsedImplicitly]
public ulong ChatGroupID { get; set; }
// This is NLog config property, it must have public get() and set() capabilities
[UsedImplicitly]
public ulong SteamID { get; set; }
// This parameter-less constructor is intentionally public, as NLog uses it for creating targets
// It must stay like this as we want to have our targets defined in our NLog.config
// Keeping date in default layout also doesn't make much sense (Steam offers that), so we remove it by default
[UsedImplicitly]
public SteamTarget() => Layout = "${level:uppercase=true}|${logger}|${message}";
protected override void InitializeTarget() {
base.InitializeTarget();
if ((SteamID == 0) || ((ChatGroupID == 0) && !new SteamID(SteamID).IsIndividualAccount)) {
throw new NLogConfigurationException(Strings.FormatErrorIsInvalid(nameof(SteamID)));
}
}
protected override async Task WriteAsyncTask(LogEventInfo logEvent, CancellationToken cancellationToken) {
ArgumentNullException.ThrowIfNull(logEvent);
Write(logEvent);
if ((Bot.Bots == null) || Bot.Bots.IsEmpty) {
return;
}
string message = Layout.Render(logEvent);
if (string.IsNullOrEmpty(message)) {
return;
}
View on GitHub (pinned to fe57c4129f)
Solutions
- Set SteamID in NLog.config to a valid personal-account SteamID64 (the bot owner's ID).
- If targetting a chat group, also set ChatGroupID to the non-zero group ID.
- Verify the SteamID64 with a tool like steamid.io; ensure it is an 'Individual' (type 1) account.
- Remove the SteamTarget block from NLog.config if you do not need Steam log delivery.
Example fix
// before (NLog.config) <target xsi:type="Steam" name="steam" /> // after <target xsi:type="Steam" name="steam" SteamID="76561198000000000" />
Defensive patterns
Strategy: validation
Validate before calling
ulong steamID = 76561198000000000UL;
var sid = new SteamKit2.SteamID(steamID);
bool valid = steamID != 0 && (chatGroupID != 0 || sid.IsIndividualAccount);
if (!valid) throw new NLogConfigurationException("SteamID invalid for SteamTarget"); Type guard
static bool IsValidSteamTargetId(ulong steamID, ulong chatGroupID) {
if (steamID == 0) return false;
if (chatGroupID != 0) return true;
return new SteamKit2.SteamID(steamID).IsIndividualAccount;
} Try / catch
try { /* NLog loads config and initializes targets */ }
catch (NLogConfigurationException ex) when (ex.Message.Contains(nameof(SteamTarget.SteamID))) {
// fix NLog.config SteamID / ChatGroupID, then restart logging
} Prevention
- Validate SteamID64 is an individual account before putting it in NLog.config.
- Keep SteamID/ChatGroupID as literal numbers, not layout renderers.
- Drop the SteamTarget block if Steam log delivery is not needed.
When it happens
Trigger: The NLog.config defines a SteamTarget whose SteamID is 0 (unset), or ChatGroupID is 0 while the SteamID does not resolve to an individual account (e.g. a clan/group ID was supplied where a personal account is required).
Common situations: Deploying NLog.config without filling in SteamID; pasting a steamID3/SteamID64 of a group instead of a personal account; using ${...} layout renderers in SteamID which NLog evaluates to a non-numeric or 0; running ASF under a user whose logging target was never configured.
Related errors
- Received unknown value for {0}, please report this: {1}
- Required field {field.Name} expects a non-null value.
- Required property {property.Name} expects a non-null value.
- steamID is null!
- Failed due to error: Client.IsConnected
AI-assisted analysis of JustArchiNET/ArchiSteamFarm@fe57c4129f (2026-08-13).
Data as JSON: /api/errors/a056cd51ddbf467f.
Report an issue: GitHub.