{"record":{"id":"4375bae3b86a4216","repo":"microsoft/aspire","slug":"parse-errors-joined-by","errorCode":null,"errorMessage":"{parse errors joined by '; '}","messagePattern":"\\{parse errors joined by '; '\\}","errorType":"validation","errorClass":"TerminalHostArgsException","httpStatus":null,"severity":"error","filePath":"src/Aspire.TerminalHost/TerminalHostArgs.cs","lineNumber":125,"sourceCode":"            shellOption,\n        };\n        // The terminal host argv comes from DCP only; treat unknown flags as a hard error\n        // so we don't silently accept garbage and start with the wrong configuration.\n        command.TreatUnmatchedTokensAsErrors = true;\n\n        var parseResult = command.Parse(args);\n        if (parseResult.Errors.Count > 0)\n        {\n            var message = new StringBuilder();\n            foreach (var error in parseResult.Errors)\n            {\n                if (message.Length > 0)\n                {\n                    message.Append(\"; \");\n                }\n                message.Append(error.Message);\n            }\n            throw new TerminalHostArgsException(message.ToString());\n        }\n\n        return new TerminalHostArgs\n        {\n            ProducerUdsPath = parseResult.GetValue(producerOption)!,\n            ConsumerUdsPath = parseResult.GetValue(consumerOption)!,\n            ControlUdsPath = parseResult.GetValue(controlOption)!,\n            Columns = parseResult.GetValue(columnsOption),\n            Rows = parseResult.GetValue(rowsOption),\n        };\n    }\n\n    private static Option<T> SingleValueOption<T>(\n        string name,\n        bool required,\n        string description,\n        T? defaultValue = default)\n    {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.TerminalHost/TerminalHostArgs.cs#L107-L143","documentation":"TerminalHostArgs.Parse aggregates all command-line parse failures from the args model and throws a single TerminalHostArgsException whose message is the individual errors joined by '; '. It indicates one or more required or malformed arguments were supplied to the Terminal Host CLI.","triggerScenarios":"Running the Terminal Host with missing required options (e.g. missing --producer-uds-path or --consumer-uds-path) or values that fail option validation; System.CommandLine reports each failure and Parse joins them.","commonSituations":"Launching the terminal host from a script or debugger with a stale or truncated command line; quotes/paths with spaces breaking argument splitting; hand-edited launch profiles omitting one of the two UDS path options.","solutions":["Read the '; '-joined message to see every failing argument and fix each one in the launch command","Ensure both producer and consumer UDS path options are passed with valid values","Check launchProfiles.json / script quoting so paths with spaces survive shell splitting"],"exampleFix":"// before\ndotnet TerminalHost --producer-uds-path /tmp/p.sock\n// after\ndotnet TerminalHost --producer-uds-path /tmp/p.sock --consumer-uds-path /tmp/c.sock","handlingStrategy":"validation","validationCode":"if (args.Length == 0 || !args.Contains(\"--producer-uds-path\") || !args.Contains(\"--consumer-uds-path\"))\n    throw new ArgumentException(\"Both --producer-uds-path and --consumer-uds-path are required.\");","typeGuard":null,"tryCatchPattern":"try { var hostArgs = TerminalHostArgs.Parse(args); }\ncatch (TerminalHostArgsException ex) { Console.Error.WriteLine(ex.Message); return 1; }","preventionTips":["Keep launch profiles and scripts that invoke the Terminal Host in sync with required options","Quote paths containing spaces","Log the full argv when launching from automation to debug split issues"],"tags":["cli","arguments","parsing"],"backgroundTag":"missing-required-argument","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}