BCUninstaller/Bulk-Crap-Uninstaller · error · ArgumentException
Failed to parse the input
Error message
Failed to parse the input
What it means
Thrown by the GuidTools parse method (the catch-all wrapping new Guid(source)). The method first extracts content inside braces/parens; if the trimmed string still cannot be parsed by the Guid constructor (which throws FormatException for bad GUID strings), it is rethrown wrapped as ArgumentException("Failed to parse the input", ex). The inner exception preserves the original parse error.
Source
Thrown at source/KlocTools/Tools/GuidTools.cs:43
if (source == null)
throw new ArgumentNullException(nameof(source));
try
{
var braceIndex = source.IndexOfAny(new[] {'{', '('});
if (braceIndex >= 0)
{
var endingBraceIndex = source.IndexOfAny(new[] {'}', ')'});
if (endingBraceIndex < 0)
throw new ArgumentException("Invalid brace format");
source = source.Substring(braceIndex, endingBraceIndex - braceIndex + 1);
}
return new Guid(source);
}
catch (Exception ex)
{
throw new ArgumentException("Failed to parse the input", ex);
}
//throw new NotImplementedException();
}
/// <summary>
/// Try to parse the supplied string into a guid. Faster than catching exceptions.
/// </summary>
public static bool GuidTryParse(string s, out Guid result)
{
result = Guid.Empty;
if (string.IsNullOrEmpty(s) || !GuidMatchRegex.IsMatch(s))
{
return false;
}
result = new Guid(s);
return true;
}
View on GitHub (pinned to 608321de98)
Solutions
- Pre-validate with GuidTools.GuidTryParse(s, out var g) (mentioned right below in the same file) and avoid the exception path entirely.
- Sanitise the input: trim whitespace and confirm it matches the standard 8-4-4-4-12 hex pattern before parsing.
- If you read from a data source, log the raw string on failure (from ex.InnerException) to locate the bad row.
Example fix
// before
var g = GuidTools.ParseGuid(input); // throws on bad input
// after
if (GuidTools.GuidTryParse(input, out var g))
Use(g);
else
logger.Warn($"Ignoring malformed GUID: {input}"); Defensive patterns
Strategy: validation
Validate before calling
if (!GuidTools.GuidTryParse(input, out var g))
return; // or surface a user-facing error
// use g Type guard
static bool IsValidGuid(string s)
=> !string.IsNullOrEmpty(s) && GuidTools.GuidTryParse(s, out _); Try / catch
try { return GuidTools.ParseGuid(input); }
catch (ArgumentException ex) { logger.Warn($"Bad GUID '{input}': {ex.InnerException?.Message}"); return Guid.Empty; } Prevention
- Always prefer GuidTryParse over the throwing parse for external input.
- Trim and brace-strip input consistently before validation.
- Log the original string from the inner exception when parse fails in batch jobs.
When it happens
Trigger: Passing a string that is not a valid GUID in any accepted form (N/D/B/P formats), e.g. "xyz", "12345", or a GUID with non-hex characters / wrong segment lengths, even after brace stripping.
Common situations: Parsing user-entered IDs, reading GUIDs from config/CSV where columns are misaligned, clipboard text with stray whitespace/punctuation, or a value extracted from inside braces that is still malformed.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- File name can't be empty.
- File name must contain an extension separated by a dot. {ful
- Minimum value must be lower than or equal to the maximum val
- Font size must be higher than 0
- Icon handle must not be zero
AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13).
Data as JSON: /api/errors/f2023034b6b01fdb.
Report an issue: GitHub.