Skip to content

ERROR Failed to import account #520

Closed

Description

@0x866

Version

v0.18.4

What happened?

I had a maFile in which the SteamID value was string-based, not numeric, and when I tried to import it, I got an error (see the log). SDA, by the way, allows importing such a maFile without errors in this case, unlike steamguard-cli. Only after I made the value an integer by removing the quotes did steamguard-cli allow me to import the maFile.

{
	...
	"Session": {
		"SteamID": "76561000000000000",
		...
	}
}

I think it would be good if steamguard-cli converted the string to an integer value on its own, so as not to do it manually and not get an error.
Because, as it turned out, I have several such maFiles in a slightly incorrect format (I don't remember where I got them).

Steps To Reproduce

Everything is described above

Relevant log output

DEBUG Args { global: GlobalArgs { username: None, password: None, all: false, mafiles_path: None, passkey: None, verbosity: Trace, no_update_check: false, http_proxy: None, proxy_credentials: None, danger_accept_invalid_certs: false }, sub: Some(Import(ImportCommand { files: ["o_76561198394789695.maFile"] })), code: CodeCommand { offline: false } }
INFO reading manifest from C:\Users\Admin\AppData\Roaming\steamguard-cli/maFiles
DEBUG loading manifest: "C:\\Users\\Admin\\AppData\\Roaming\\steamguard-cli/maFiles\\manifest.json"
DEBUG passkey was revoked from manifest
DEBUG Performing auto-upgrade...
DEBUG Manifest is up to date
DEBUG loading entry: "76561000000000000.maFile"
DEBUG Falling back to external account import
ERROR Failed to import account: 76561000000000000.maFile Failed to parse as JSON: data did not match any variant of untagged enum ExternalAccount
Failed to parse as Winauth export: parsing as winauth export URL
ERROR The original error was: missing field `steam_id` at line 20 column 1
INFO Saving manifest and accounts...
DEBUG saving manifest
DEBUG Checking for updates to dyc3/steamguard-cli v0.18.4
DEBUG No update available

Activity

  1. dyc3 commented on Sep 22, 2026

    @dyc3
    Owner

    i could have sworn we already did this. in fact, I think we ignore Session in SDA files. @pullfrog can you confirm?

  2. pullfrog commented on Sep 22, 2026

    @pullfrog
    Contributor

    Confirmed: we do not ignore Session during SDA import. SdaAccount.session is optional, but if present it is deserialized; Session.SteamID is currently Option<u64> and is copied into the migrated account (src/accountmanager/legacy.rs:140-170). The other legacy session fields are discarded during conversion.

    You may be remembering #284: it made the individual Session fields, including SteamID, tolerate missing or null values. It did not make SteamID accept a quoted number, so the report in #520 identifies a real unsupported input shape rather than already-covered behavior.

    Task list (3/3 completed)
    • Trace SDA maFile deserialization and Session handling
    • Check tests and git history for prior compatibility work
    • Report confirmed behavior and issue implications

    Pullfrog  | View workflow run | via Pullfrog | Using GPT Sol (free via Pullfrog for OSS) | 𝕏

  3. dyc3 commented on Sep 22, 2026

    @dyc3
    Owner

    @pullfrog speculate based on the info provided in this issue. For what reasons would the "data did not match any variant of untagged enum ExternalAccount" error be hit?

  4. pullfrog commented on Sep 22, 2026

    @pullfrog
    Contributor

    The most likely sequence is:

    1. The normal import path first tries the current SteamGuardAccount schema. This file is an SDA-style maFile and has no top-level steam_id, so the logged original error, missing field steam_id, is expected and triggers the external-format fallback.
    2. The fallback deserializes ExternalAccount, an untagged enum with two variants: SdaAccount and SteamMobileV2 (src/accountmanager/migrate.rs:303-309).
    3. The file otherwise looks like SdaAccount, but that variant defines Session.SteamID as Option<u64> (src/accountmanager/legacy.rs:144-159). Option permits the field to be missing or null; it does not permit a numeric JSON string. Therefore "76561000000000000" rejects the SDA variant.
    4. Serde then tries SteamMobileV2. That format expects a required top-level field named steamid, not nested Session.SteamID (src/accountmanager/steamv2.rs:26-29). Although its custom parser accepts either a string or number, the field is absent in an SDA maFile, so this variant also fails.
    5. Because neither untagged variant succeeds, Serde discards the useful variant-specific errors and reports the generic data did not match any variant of untagged enum ExternalAccount message.

    The fact that changing only Session.SteamID from a string to a JSON number makes the import succeed strongly supports this explanation. More generally, this generic error can be produced by any missing required field or incompatible field value/type that rejects the SDA variant when the same object also lacks the required Steam Mobile v2 shape. The Winauth error is just the final fallback being attempted against a valid JSON maFile and is not the cause.

    Pullfrog  | View workflow run | via Pullfrog | Using GPT Sol (free via Pullfrog for OSS) | 𝕏

  5. dyc3 commented on Sep 22, 2026

    @dyc3
    Owner

    @0x866 Looks like I need some more info. Whats the full json structure of the file you are trying to import?

  6. 0x866 commented on Sep 22, 2026

    @0x866
    Author

    @0x866 Looks like I need some more info. Whats the full json structure of the file you are trying to import?

    {
    	"shared_secret": "IqJL+YnMBFQ/G6C/K/LH2P5nRbY=",
    	"serial_number": "14767137786155771371",
    	"revocation_code": "R00000",
    	"uri": "otpauth://totp/Steam:username_acc?secret=EKREX6MJZQCFIPY3UC7SX4WH3D7GORNW&issuer=Steam",
    	"account_name": "username_acc",
    	"token_gid": "5f28d367c8d78a0",
    	"identity_secret": "xcjQk1vCYozVrNoC5dDqu6l21gk=",
    	"secret_1": "orbyX5jYv+e/8kxG9GGwtBFjc94=",
    	"device_id": "android:9f8a83ba-c264-4d53-9b87-ef6628da6618",
    	"server_time": 1790072054,
    	"fully_enrolled": true,
    	"Session": {
    		"SteamID": "76561000000000000",
    		"SessionID": "4dd7d775277043d772537f67",
    		"SteamLoginSecure": "76561000000000000%7C%7CeyAidHlwIjogIkpXVCIsICJhbGciOiAiRWREU0EiIH0.eyAiaXNzIjogInI6MDAxOV8yOEQzNjg0Nl9BQzQ2MCIsICJzdWIiOiAiNzY1NjExOTgzOTQ3ODk2OTUiLCAiYXVkIjogWyAid2ViOnN0b3JlIiBdLCAiZXhwIjogMTc5MDE1OTg0NCwgIm5iZiI6IDE3ODE0MzIyMjEsICJpYXQiOiAxNzkwMDcyMjIxLCAianRpIjogIjAwMTJfMjhEMzY4NDZfQ0JCNkEiLCAib2F0IjogMTc5MDA3MjIyMCwgInJ0X2V4cCI6IDE4MDgyNTUwMzYsICJwZXIiOiAwLCAiaXBfc3ViamVjdCI6ICIxODYuNTcuMTMuMTA1IiwgImlwX2NvbmZpcm1lciI6ICI1LjE0LjEzMy42NiIgfQ.aoVbu5TUmNp1ZTnSHp6n9SyhhPQBZc8Covl0W3o-mnFfXUpUlH2Yvb0WSWa7IgsN9Fs2p1qERnlz9quXtsPxAg",
    		"AccessToken": "eyAidHlwIjogIkpXVCIsICJhbGciOiAiRWREU0EiIH0.eyAiaXNzIjogInI6MDAwQ18yOEQzNjg0OF83QUE2MyIsICJzdWIiOiAiNzY1NjExOTgzOTQ3ODk2OTUiLCAiYXVkIjogWyAid2ViIiBdLCAiZXhwIjogMTc5MDE3MDUxMCwgIm5iZiI6IDE3ODE0NDQwNjEsICJpYXQiOiAxNzkwMDg0MDYxLCAianRpIjogIjAwMTJfMjhEMzY4NDlfQzE4NTEiLCAib2F0IjogMTc5MDA4NDA2MSwgInJ0X2V4cCI6IDE4MDgzMzA3OTksICJwZXIiOiAwLCAiaXBfc3ViamVjdCI6ICI5NC4yMDEuMjQ1LjI1MSIsICJpcF9jb25maXJtZXIiOiAiMTcyLjkuMTA5LjIzMyIgfQ.pIyhbuwMq27UMM8PCkAUBG3-jUt6vUATPQliaxEW3EmzNdFezlXbfTr4AHDl_8d9VfvFFiAy74GA4KVmVyAyBg",
    		"RefreshToken": "eyAidHlwIjogIkpXVCIsICJhbGciOiAiRWREU0EiIH0.eyAiaXNzIjogInN0ZWFtIiwgInN1YiI6ICI3NjU2MTE5ODM5NDc4OTY5NSIsICJhdWQiOiBbICJ3ZWIiLCAicmVuZXciLCAiZGVyaXZlIiBdLCAiZXhwIjogMTgwODMzMDc5OSwgIm5iZiI6IDE3ODE0NDQwNjEsICJpYXQiOiAxNzkwMDg0MDYxLCAianRpIjogIjAwMENfMjhEMzY4NDhfN0FBNjMiLCAib2F0IjogMTc5MDA4NDA2MSwgInBlciI6IDEsICJpcF9zdWJqZWN0IjogIjk0LjIwMS4yNDUuMjUxIiwgImlwX2NvbmZpcm1lciI6ICIxNzIuOS4xMDkuMjMzIiB9.zlOPqMtjrVmEU8t3H-4Zyw1_Ys5mx96F2L5Zrh27nCfCsqTJyolPwa7z3z2g-BcU-tWyka6q1TQa0cpmsUMHDA"
    	}
    }
  7. dyc3 commented on Sep 22, 2026

    @dyc3
    Owner

    @pullfrog use the posted json. fully troubleshoot the issue, find the root cause. explain the bug here, and make a PR with the fix

  8. pullfrog commented on Sep 22, 2026

    @pullfrog
    Contributor

    Reproduced the failure with a sanitized copy of the posted JSON: the initial current-format parse correctly falls back because SDA files lack top-level steam_id, but the SDA variant then rejects quoted Session.SteamID because Option<u64> does not coerce JSON strings; the other untagged variant also fails, which hides the useful cause behind Serde’s generic data did not match any variant message (and the later Winauth error is unrelated). PR #521 fixes the SDA field to accept either a JSON number or quoted decimal string while preserving missing/null behavior, and adds a regression fixture matching the posted session shape: #521. The end-to-end import now succeeds, and all 30 CLI tests, formatting, and diff checks pass.

    Task list (5/5 completed)
    • Reproduce issue ERROR Failed to import account #520 with the posted maFile JSON and identify the exact deserialization failure
    • Implement the smallest compatible parser fix and regression tests
    • Run formatting and relevant test suites
    • Self-review, commit, push, and open a pull request
    • Explain the root cause and report the PR on issue ERROR Failed to import account #520

    Pullfrog  | View workflow run | via Pullfrog | Using GPT Sol (free via Pullfrog for OSS) | 𝕏

  9. dyc3 commented on Sep 22, 2026

    @dyc3
    Owner

    Thanks for the quick and helpful responses @0x866!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions