{"record":{"id":"b6c1f29bd46d80fa","repo":"felixse/FluentTerminal","slug":"userinfo-part-contains-parts-length-elements-b6c1f2","errorCode":null,"errorMessage":"UserInfo part contains ${parts.Length} elements.","messagePattern":"UserInfo part contains (.+?) elements\\.","errorType":"validation","errorClass":"FormatException","httpStatus":null,"severity":"error","filePath":"FluentTerminal.App/ViewModels/Profiles/SshConnectViewModel.cs","lineNumber":404,"sourceCode":"            IApplicationView applicationView, ITrayProcessCommunicationService trayProcessCommunicationService,\n            IFileSystemService fileSystemService, IApplicationDataContainer historyContainer)\n        {\n            var vm = new SshConnectViewModel(settingsService, applicationView, trayProcessCommunicationService,\n                fileSystemService)\n            {\n                Host = uri.Host,\n                UseMosh = MoshUriScheme.Equals(uri.Scheme, StringComparison.OrdinalIgnoreCase)\n            };\n\n            if (uri.Port >= 0)\n                vm.SshPort = (ushort)uri.Port;\n\n            if (!string.IsNullOrEmpty(uri.UserInfo))\n            {\n                string[] parts = uri.UserInfo.Split(';');\n\n                if (parts.Length > 2)\n                    throw new FormatException($\"UserInfo part contains {parts.Length} elements.\");\n\n                vm.Username = HttpUtility.UrlDecode(parts[0]);\n\n                if (parts.Length > 1)\n                {\n                    // For now we are only interested in IdentityFile option\n                    Tuple<string, string> identityFileOption = ParseParams(parts[1], ',').FirstOrDefault(p =>\n                        string.Equals(p.Item1, IdentityFileOptionName, StringComparison.OrdinalIgnoreCase));\n\n                    vm.IdentityFile = identityFileOption?.Item2;\n                }\n            }\n\n            // ReSharper disable once ConstantConditionalAccessQualifier\n            string queryString = uri.Query?.Trim();\n\n            if (string.IsNullOrEmpty(queryString))\n            {","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/felixse/FluentTerminal/blob/ba83ec485eea8d8ee65825711731300bee2e76ed/FluentTerminal.App/ViewModels/Profiles/SshConnectViewModel.cs#L386-L422","documentation":"Same FormatException as the App.ViewModels copy: SshConnectViewModel.ParseUri splits uri.UserInfo on ';' and requires at most two parts (username; optional options). More than two segments is treated as a malformed SSH/Mosh URI. This instance lives under the FluentTerminal.App project layout.","triggerScenarios":"ParseUri receives an ssh:// or mosh:// URI whose UserInfo has three or more ';'-delimited segments. The guard fires before username/options are read.","commonSituations":"Malformed pasted SSH URL; unencoded ';' inside a username or IdentityFile value; a config generator emitted extra segments; wrong provider routed to SSH parser.","solutions":["Encode ';' characters in UserInfo values as %3B, or keep UserInfo to a single username plus at most one options segment.","Validate the URI shape before invoking ParseUri and surface a clear error.","Use the documented format ssh://user;IdentityFile=<path>@host."],"exampleFix":"// before\nif (parts.Length > 2)\n    throw new FormatException($\"UserInfo part contains {parts.Length} elements.\");\n\n// after - clearer, structured message\nif (parts.Length > 2)\n    throw new FormatException($\"SSH UserInfo has {parts.Length} segments; expected 'user' or 'user;options'.\");","handlingStrategy":"validation","validationCode":"if (!string.IsNullOrEmpty(uri.UserInfo) && uri.UserInfo.Split(';').Length > 2)\n    throw new FormatException($\"SSH UserInfo has too many segments.\");","typeGuard":"static bool IsValidSshUserInfo(Uri uri) => string.IsNullOrEmpty(uri.UserInfo) || uri.UserInfo.Split(';').Length <= 2;","tryCatchPattern":"try { vm = SshConnectViewModel.ParseUri(uri, ...); }\ncatch (FormatException ex) { notifyUser($\"Invalid SSH link: {ex.Message}\"); }","preventionTips":["Encode ';' in UserInfo values as %3B.","Limit UserInfo to user plus one options segment.","Validate the URI before parsing."],"tags":["uri-parsing","ssh","mosh","input-validation"],"backgroundTag":null,"analyzedSha":"ba83ec485eea8d8ee65825711731300bee2e76ed","analyzedAt":"2026-08-13T21:23:15.467Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}