BornToBeRoot/NETworkManager · error · InvalidOperationException

Group ' ' not found.

Error message

Group '{name}' not found.

What it means

GetGroupByName looked up LoadedProfileFileData.Groups for a group whose Name equals the requested name and found no match, so it throws InvalidOperationException after the initial ArgumentException guard on null/empty name. It signals that the caller referenced a group (e.g. as a profile's Group value) that does not exist in the currently loaded profile file — a sentinel lookup failure, not a file I/O problem.

Solutions

  1. Call GroupExists(name) before GetGroupByName to verify the group is present.
  2. Check for exact-name mismatches: trailing whitespace or case differences in the group name.
  3. Create the missing group with AddGroup before referencing it.
  4. Refresh/reload the profile file if the group was added by another component and is not yet in the loaded data.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1145 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BornToBeRoot/NETworkManager@2780d65469 (2026-09-12). Data as JSON: /api/errors/a208f5831e8f2994. Report an issue: GitHub.

Appendix: source

Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1145

        ProfilesUpdated(profilesChanged);
    }

    /// <summary>
    ///     Method to get a group by name.
    /// </summary>
    /// <param name="name">Name of the group.</param>
    /// <returns>Group as <see cref="GroupInfo" />.</returns>
    /// <exception cref="ArgumentException">Thrown when name is null or empty.</exception>
    /// <exception cref="InvalidOperationException">Thrown when group with specified name is not found.</exception>
    public static GroupInfo GetGroupByName(string name)
    {
        ArgumentException.ThrowIfNullOrWhiteSpace(name);


        var group = LoadedProfileFileData.Groups.FirstOrDefault(x => x.Name.Equals(name));

        if (group == null)
            throw new InvalidOperationException($"Group '{name}' not found.");

        return group;
    }

    /// <summary>
    ///     Method to replace a group.
    /// </summary>
    /// <param name="oldGroup">Old group as <see cref="GroupInfo" />.</param>
    /// <param name="newGroup">New group as <see cref="GroupInfo" />.</param>
    /// <exception cref="ArgumentNullException">Thrown when oldGroup or newGroup is null.</exception>
    public static void ReplaceGroup(GroupInfo oldGroup, GroupInfo newGroup)
    {
        ArgumentNullException.ThrowIfNull(oldGroup);
        ArgumentNullException.ThrowIfNull(newGroup);

        LoadedProfileFileData.Groups.Remove(oldGroup);
        LoadedProfileFileData.Groups.Add(newGroup);

View on GitHub (pinned to 2780d65469)