languagetool-org/languagetool · error · RuntimeException
Could not handle URL click: ${url}
Error message
Could not handle URL click: ${url} What it means
In the LanguageTool standalone GUI, clicking a hyperlink in results opens the URL via Tools.openURL(); if any exception occurs (malformed URI, no browser/desktop available, OS failure), hyperlinkUpdate wraps it in a RuntimeException with this message. The original cause is attached as the exception cause.
Source
Thrown at languagetool-standalone/src/main/java/org/languagetool/gui/ResultAreaHelper.java:327
filtered.add(ruleMatch);
}
}
return filtered;
}
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
URL url = e.getURL();
try {
String uri = url.toURI().toString();
if (uri.startsWith(DEACTIVATE_URL) || uri.startsWith(REACTIVATE_URL)) {
handleRuleLinkClick(uri);
} else {
Tools.openURL(url);
}
} catch (Exception ex) {
throw new RuntimeException("Could not handle URL click: " + url, ex);
}
}
}
private void handleRuleLinkClick(String uri) throws IOException {
RuleLink ruleLink = RuleLink.getFromString(uri);
String ruleId = ruleLink.getId();
if (uri.startsWith(DEACTIVATE_URL)) {
ltSupport.disableRule(ruleId);
} else {
ltSupport.enableRule(ruleId);
}
ltSupport.getConfig().saveConfiguration(ltSupport.getLanguage());
ltSupport.checkImmediately(this);
}
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Inspect the exception cause to see why openURL failed
- Set/repair the default browser or Desktop.browse() support on the OS
- Copy the URL manually into a browser if the GUI cannot open it
- Check that the clicked rule link URI is well-formed; report a bug if it comes from built-in rules
Defensive patterns
Strategy: try-catch
Try / catch
try { Tools.openURL(url); } catch (Exception ex) { log.warn("Could not open URL: " + url, ex); JOptionPane.showMessageDialog(parent, "Please open manually: " + url); } Prevention
- Run the GUI on a system with a default browser configured
- Validate URIs in custom rule descriptions
- Catch and log around link handling so one bad link doesn't break the UI
When it happens
Trigger: Clicking an external link (e.g. rule documentation URL) in the GUI results pane when the URI is invalid or the platform cannot launch a browser; handleRuleLinkClick failing to parse a rule link URI.
Common situations: Running standalone on a headless system without a default browser; corrupted rule-link strings; URI syntax problems in custom rule descriptions.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- Invalid userInfo format, expected 'user:password':
- Could not parse URL for rule:
- Could not parse URL for rule: ${rule}: '${urlForRuleGroup}'
- MalformedURLException for decommunization URL
- Could not parse provided serverURL: ''
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/72f32eafabfb7f05.
Report an issue: GitHub.