{"record":{"id":"091dc243be36f237","repo":"gibbed/SteamAchievementManager","slug":"appid-mismatch","errorCode":null,"errorMessage":"appID mismatch","messagePattern":"appID mismatch","errorType":"exception","errorClass":"ClientInitializeException","httpStatus":null,"severity":"error","filePath":"SAM.API/Client.cs","lineNumber":83,"sourceCode":"                throw new ClientInitializeException(ClientInitializeFailure.CreateSteamClient, \"failed to create ISteamClient018\");\n            }\n\n            this._Pipe = this.SteamClient.CreateSteamPipe();\n            if (this._Pipe == 0)\n            {\n                throw new ClientInitializeException(ClientInitializeFailure.CreateSteamPipe, \"failed to create pipe\");\n            }\n\n            this._User = this.SteamClient.ConnectToGlobalUser(this._Pipe);\n            if (this._User == 0)\n            {\n                throw new ClientInitializeException(ClientInitializeFailure.ConnectToGlobalUser, \"failed to connect to global user\");\n            }\n\n            this.SteamUtils = this.SteamClient.GetSteamUtils004(this._Pipe);\n            if (appId > 0 && this.SteamUtils.GetAppId() != (uint)appId)\n            {\n                throw new ClientInitializeException(ClientInitializeFailure.AppIdMismatch, \"appID mismatch\");\n            }\n\n            this.SteamUser = this.SteamClient.GetSteamUser012(this._User, this._Pipe);\n            this.SteamUserStats = this.SteamClient.GetSteamUserStats013(this._User, this._Pipe);\n            this.SteamApps001 = this.SteamClient.GetSteamApps001(this._User, this._Pipe);\n            this.SteamApps008 = this.SteamClient.GetSteamApps008(this._User, this._Pipe);\n        }\n\n        ~Client()\n        {\n            this.Dispose(false);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (this._IsDisposed == true)\n            {\n                return;","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/gibbed/SteamAchievementManager/blob/de8b71048a0cee3c3e97cd8535e0f55ca86513e4/SAM.API/Client.cs#L65-L101","documentation":"Client.Initialize throws ClientInitializeException with failure code AppIdMismatch when a positive appId was passed but SteamUtils.GetAppId() (queried from the running Steam session) returns a different app id. This means the process is attached to a Steam context for a different game than requested — typically because the SteamAppId environment variable was already set or the pipe belongs to another app.","triggerScenarios":"Calling Client.Initialize(appId) with appId > 0 while the environment variable SteamAppId was preset to another value, or the connected Steam session is bound to a different application.","commonSituations":"A launcher or parent process already set SteamAppId; running from inside another game's context; developer reusing a shell where a previous app id was exported; SAM pointed at the wrong game while Steam runs another.","solutions":["Clear/override the SteamAppId environment variable to the desired app id before initializing","Restart Steam so it binds to the intended app id","Pass the correct appId for the game the Steam session is actually running","Launch the target game in Steam first, then initialize"],"exampleFix":"// before\nclient.Initialize(440); // SteamAppId=730 still set -> mismatch\n// after\nEnvironment.SetEnvironmentVariable(\"SteamAppId\", \"440\");\nclient.Initialize(440);","handlingStrategy":"validation","validationCode":"var current = Environment.GetEnvironmentVariable(\"SteamAppId\");\nif (current != null && current != appId.ToString())\n    Environment.SetEnvironmentVariable(\"SteamAppId\", appId.ToString());","typeGuard":null,"tryCatchPattern":"try { client.Initialize(appId); }\ncatch (ClientInitializeException e) when (e.Failure == ClientInitializeFailure.AppIdMismatch)\n{\n    // Reset SteamAppId and retry once\n    Environment.SetEnvironmentVariable(\"SteamAppId\", appId.ToString());\n}","preventionTips":["Always set SteamAppId explicitly before Initialize","Don't reuse shells/launchers that export a different SteamAppId","Run Steam against the intended game before initializing"],"tags":["steam","appid","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"de8b71048a0cee3c3e97cd8535e0f55ca86513e4","analyzedAt":"2026-09-12T09:05:06.619Z","contentChangedAt":"2026-09-12T09:05:06.619Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}