{"record":{"id":"ad5caf8eaa723049","repo":"BeyondDimension/SteamTools","slug":"no-serial-number","errorCode":null,"errorMessage":"no serial_number","messagePattern":"no serial_number","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"warning","filePath":"src/BD.WTTS.Client.Plugins.Authenticator/UI/ViewModels/SteamGuardImportPageViewModel.cs","lineNumber":104,"sourceCode":"            if (string.IsNullOrEmpty(deviceId) || DeviceIdRegex().IsMatch(deviceId) == false)\n                //WinAuthForm.ErrorDialog(this, \"Invalid deviceid, expecting \\\"android:NNNN...\\\"\");\n                return;\n\n            // check the steamguard\n            byte[] secret;\n            string? serial;\n            var steamGuardModel = SJsonSerializer.Deserialize(PhoneImportSteamGuard,\n                ImportFileModelJsonContext.Default.SteamGuardModel);\n\n            if (steamGuardModel == null) return;\n\n            if (string.IsNullOrEmpty(steamGuardModel.SharedSecret))\n                throw new ApplicationException(\"no shared_secret\");\n\n            secret = Convert.FromBase64String(steamGuardModel.SharedSecret);\n\n            if (string.IsNullOrEmpty(steamGuardModel.SerialNumber))\n                throw new ApplicationException(\"no serial_number\");\n\n            serial = steamGuardModel.SerialNumber;\n\n            var auth = new SteamAuthenticator\n            {\n                SecretKey = secret,\n                Serial = serial,\n                SteamData = PhoneImportSteamGuard,\n                DeviceId = deviceId,\n            };\n\n            await AuthenticatorHelper.SaveAuthenticator(new AuthenticatorDTO\n            {\n                Name = $\"(Steam){ImportAuthNewName}\",\n                Value = auth,\n                Created = DateTimeOffset.Now,\n            });\n        }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/BeyondDimension/SteamTools/blob/c16ffa08e03b192d23ada290c4969e77f9201f3d/src/BD.WTTS.Client.Plugins.Authenticator/UI/ViewModels/SteamGuardImportPageViewModel.cs#L86-L122","documentation":"Thrown during Steam Guard import when the deserialized SteamGuardModel has an empty/null SerialNumber. The serial is stored on the SteamAuthenticator and is needed for code generation/refresh, so its absence aborts import right after the shared-secret check.","triggerScenarios":"Importing a Steam Guard JSON blob where the 'serial_number' field is missing or empty, even though shared_secret was present.","commonSituations":"Export omitted the serial; JSON redacted/truncated; field renamed in a newer schema; partial manual edit of the export file.","solutions":["Re-export the Steam Guard data with the serial_number field populated.","Copy the serial from the Steam mobile authenticator/account and add it to the JSON before import.","Validate required fields up front and report all missing ones in one message.","Reject the file in the UI with the specific missing field named."],"exampleFix":"// before\nif (string.IsNullOrEmpty(steamGuardModel.SerialNumber))\n    throw new ApplicationException(\"no serial_number\");\n\n// after\nif (string.IsNullOrEmpty(steamGuardModel.SerialNumber))\n    throw new ArgumentException(Strings.Import_SteamMissingSerial);","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(model.SerialNumber))\n    errors.Add(\"Steam Guard import missing 'serial_number'.\");\n// Combine with the shared_secret check so all missing fields are reported at once.","typeGuard":"bool HasSerial(SteamGuardModel? m) => !string.IsNullOrWhiteSpace(m?.SerialNumber);","tryCatchPattern":"try { ImportSteamGuard(json); }\ncatch (ApplicationException ex) when (ex.Message == \"no serial_number\")\n{\n    importErrors.Add(\"Steam Guard file lacks 'serial_number'.\");\n}","preventionTips":["Pre-validate the Steam Guard model fields and collect all missing ones before acting.","Document the required Steam Guard JSON schema in the import UI.","Reject files missing required fields with a clear list rather than throwing mid-import.","Re-export from a source that includes both shared_secret and serial_number."],"tags":["authenticator","steam","import","validation"],"backgroundTag":null,"analyzedSha":"c16ffa08e03b192d23ada290c4969e77f9201f3d","analyzedAt":"2026-08-13T11:52:20.410Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}