BornToBeRoot/NETworkManager · error · InvalidOperationException
Failed to deserialize JSON profile file.
Error message
Failed to deserialize JSON profile file.
What it means
Save (also invoked by RenameProfileFile, EnableEncryption, ChangeMasterPassword, DisableEncryption) failed to deserialize the profile file JSON: either the JSON text did not match the ProfileFileData schema (JsonException) and the legacy-format fallback also failed, or deserialization produced null. The file content is corrupt, truncated, hand-edited, or of an unrecognized schema, so the load step of the save pipeline cannot proceed.
Solutions
- Validate the profile file with a JSON linter and repair syntax errors (trailing commas, truncated content).
- Restore the profile file from an automatic backup or a recent copy.
- If the file is unreadable, move it aside and let the application create a fresh profile file, then re-import profiles.
- Ensure the file was not saved with a different/older schema or manually edited in a way that breaks deserialization.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1029 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/cbdd1b0fdfe498e7.
Report an issue: GitHub.
Appendix: source
Thrown at Source/NETworkManager.Profiles/ProfileManager.cs:1029
{
var profileFileData = JsonSerializer.Deserialize<ProfileFileData>(jsonString, JsonOptions);
if (profileFileData != null)
{
LoadedProfileFileData = profileFileData;
return;
}
}
catch (JsonException)
{
Log.Info("Failed to deserialize as ProfileFileData, trying legacy format (direct Groups array)...");
}
// Fallback: Try to deserialize as legacy format (direct array of GroupInfoSerializable)
var groupsSerializable = JsonSerializer.Deserialize<List<GroupInfoSerializable>>(jsonString, JsonOptions);
if (groupsSerializable == null)
throw new InvalidOperationException("Failed to deserialize JSON profile file.");
// Create ProfileFileData wrapper for legacy format
LoadedProfileFileData = new ProfileFileData
{
GroupsSerializable = groupsSerializable
};
Log.Info("Successfully loaded profile file in legacy format. It will be migrated to new format on next save.");
}
/// <summary>
/// Method to deserialize a list of groups as <see cref="GroupInfo" /> from an XML stream.
/// </summary>
/// <param name="stream">Stream to deserialize.</param>
[Obsolete("Legacy XML profile files are no longer used, but the method is kept for migration purposes.")]
private static void DeserializeFromXmlStream(Stream stream)
{
XmlSerializer xmlSerializer = new(typeof(List<GroupInfoSerializable>));View on GitHub (pinned to 2780d65469)