felixse/FluentTerminal · error · Exception
Invalid link.
Error message
Invalid link.
What it means
Thrown by CommandProfileProviderViewModel when the parsed query string contains no recognized custom-command parameter (CustomCommandQueryStringName). The provider builds a command-based profile from a URL; if the query lacks the expected 'command=...' key it cannot construct the profile and throws a generic Exception with the localized 'Invalid link.' text.
Source
Thrown at FluentTerminal.App/ViewModels/CommandProfileProviderViewModel.cs:432
if (string.IsNullOrEmpty(queryString))
{
return vm;
}
if (queryString.StartsWith("?", StringComparison.Ordinal))
{
queryString = queryString.Substring(1);
}
var queryStringParams = ParseParams(queryString, '&').ToList();
var cmdParam = queryStringParams.FirstOrDefault(t =>
CustomCommandQueryStringName.Equals(t.Item1, StringComparison.OrdinalIgnoreCase));
if (cmdParam == null)
{
throw new Exception(I18N.TranslateWithFallback("InvalidLink", "Invalid link."));
}
vm._command = cmdParam.Item2;
vm.LoadBaseFromQueryString(queryStringParams);
return vm;
}
public override async Task<Tuple<bool, string>> GetUrlAsync()
{
var error = await ValidateAsync().ConfigureAwait(false);
if (!string.IsNullOrEmpty(error))
{
return Tuple.Create(false, error);
}
View on GitHub (pinned to ba83ec485e)
Solutions
- Ensure the link's query string includes the custom command parameter, e.g. ?command=ls%20-la.
- Validate the URL scheme and required parameters in the caller before dispatching to this provider.
- Catch the exception and show the user that the link is invalid rather than crashing.
Example fix
// before
var cmdParam = queryStringParams.FirstOrDefault(t => CustomCommandQueryStringName.Equals(t.Item1, StringComparison.OrdinalIgnoreCase));
if (cmdParam == null)
throw new Exception(I18N.TranslateWithFallback("InvalidLink", "Invalid link."));
// after - throw a typed, parameterized exception
if (cmdParam == null)
throw new ArgumentException($"Invalid link: missing '{CustomCommandQueryStringName}' query parameter."); Defensive patterns
Strategy: validation
Validate before calling
// Ensure the query carries the command parameter before dispatching.
var qs = System.Web.HttpUtility.ParseQueryString(uri.Query.TrimStart('?'));
if (string.IsNullOrEmpty(qs[CustomCommandQueryStringName]))
throw new ArgumentException($"Link missing '{CustomCommandQueryStringName}' parameter."); Try / catch
try { vm = CommandProfileProviderViewModel.Parse(uri, ...); }
catch (Exception ex) when (ex.Message.Contains("Invalid link")) { notifyUser("The link is not a valid command profile link."); } Prevention
- Validate the URL scheme and required query parameters before routing to the provider.
- Author command links with the expected ?command=... parameter.
- Catch and degrade gracefully on invalid links.
When it happens
Trigger: ParseUrl/ParseQueryString processes a command-profile link whose query string is empty or contains only unrelated parameters; the cmdParam lookup via FirstOrDefault returns null, hitting the throw.
Common situations: User clicks/opens a malformed fluent-terminal:// link missing the command parameter; the link was hand-authored or truncated; a different provider's link is routed to the command provider by mistake.
Related errors
- UserInfo part contains {parts.Length} elements.
- UserInfo part contains ${parts.Length} elements.
- Root node was not a dictionary.
- Color node was not a dictionary
AI-assisted analysis of felixse/FluentTerminal@ba83ec485e (2026-08-13).
Data as JSON: /api/errors/ce74cfdbc56d98e0.
Report an issue: GitHub.