{"record":{"id":"0e81529948c833c2","repo":"ppy/osu","slug":"provided-client-id-must-be-an-integer","errorCode":null,"errorMessage":"Provided client ID must be an integer.","messagePattern":"Provided client ID must be an integer\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"osu.Desktop/Program.cs","lineNumber":98,"sourceCode":"            foreach (string arg in args)\r\n            {\r\n                string[] split = arg.Split('=');\r\n\r\n                string key = split[0];\r\n                string val = split.Length > 1 ? split[1] : string.Empty;\r\n\r\n                switch (key)\r\n                {\r\n                    case \"--tournament\":\r\n                        tournamentClient = true;\r\n                        break;\r\n\r\n                    case \"--debug-client-id\":\r\n                        if (!DebugUtils.IsDebugBuild)\r\n                            throw new InvalidOperationException(\"Cannot use this argument in a non-debug build.\");\r\n\r\n                        if (!int.TryParse(val, out int clientID))\r\n                            throw new ArgumentException(\"Provided client ID must be an integer.\");\r\n\r\n                        gameName = $\"{base_game_name}-{clientID}\";\r\n                        break;\r\n                }\r\n            }\r\n\r\n            var hostOptions = new HostOptions\r\n            {\r\n                IPCPipeName = !tournamentClient ? OsuGame.IPC_PIPE_NAME : null,\r\n                FriendlyGameName = OsuGameBase.GAME_NAME,\r\n            };\r\n\r\n            using (DesktopGameHost host = Host.GetSuitableDesktopHost(gameName, hostOptions))\r\n            {\r\n                if (!host.IsPrimaryInstance)\r\n                {\r\n                    if (trySendIPCMessage(host, cwd, args))\r\n                        return;\r","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Desktop/Program.cs#L80-L116","documentation":"The --debug-client-id flag expects an integer value that is appended to the game's base name (e.g., osu!-2). If the value cannot be parsed as an int via int.TryParse, an ArgumentException is thrown. This occurs in the same switch-case as the debug-build check, so it only fires in debug builds.","triggerScenarios":"Passing --debug-client-id with a non-numeric value such as --debug-client-id abc, or providing the flag with no value at all (the arg-splitting logic yields an empty string when no = or trailing value is present).","commonSituations":"Typo in a launch script; argument value left blank; argument parser mis-splitting key=value pairs; copy-pasting a human-readable ID instead of a number.","solutions":["Provide a valid integer value after --debug-client-id.","If using key=value syntax, ensure the value side is numeric: --debug-client-id=2.","Validate the argument in your launch script before passing it to the process."],"exampleFix":"// before\n// args: [\"--debug-client-id\", \"two\"]\n\n// after\n// args: [\"--debug-client-id\", \"2\"]","handlingStrategy":"validation","validationCode":"// Validate the client ID before passing it to the process\nstring clientIdRaw = GetArgValue(args, \"--debug-client-id\");\nif (!string.IsNullOrEmpty(clientIdRaw) && !int.TryParse(clientIdRaw, out _))\n    throw new ArgumentException($\"--debug-client-id must be an integer, got: {clientIdRaw}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate integer arguments before spawning the process.","Use a typed argument parser (e.g., a record with int properties) instead of raw string splitting."],"tags":["command-line","validation","argument-parsing","osu-desktop"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}