Repository navigation
Description
Before you submit
- I searched existing issues and did not find the same problem.
- I am using the latest available PasarGuard version, or I included the exact version below.
PasarGuard version
v5.4.1
Installation type
Docker
What happened?
[Bug] Hysteria subscription generation fails when udpHop is None
Description
Hysteria subscription generation fails with an AttributeError when the optional udpHop field is not configured in FinalMask.
In the FinalMaskQuicParams Pydantic model, udpHop defaults to None. However, the subscription generators expect it to be a dictionary.
Error
The issue occurs in both links.py and clash.py.
links.py (line 327):
payload["mports"] = quic_params.get("udpHop", {}).get("ports", "")clash.py (line 697):
node["ports"] = quic_params.get("udpHop", {}).get("ports", "")Both can raise:
AttributeError: 'NoneType' object has no attribute 'get'
Root Cause
When a FinalMask Pydantic model is serialized using:
finalmask.model_dump(by_alias=True)Optional fields with None values are included in the resulting dictionary.
For example:
{
"quicParams": {
"udpHop": None
}
}Calling .get("udpHop", {}) returns None because the key exists, even though its value is None.
Suggested Fix
Option 1: Exclude None values during serialization:
finalmask.model_dump(by_alias=True, exclude_none=True)Option 2: Safely handle None values in subscription generators:
payload["mports"] = (quic_params.get("udpHop") or {}).get("ports") or ""node["ports"] = (quic_params.get("udpHop") or {}).get("ports") or ""Expected Behavior
Hysteria subscription generation should succeed when udpHop is not configured, without raising an exception.
Actual Behavior
Subscription generation fails with AttributeError when udpHop is None.
Steps to reproduce
- enable "disablePathMTUDiscovery" in hysteria finalmask (quic)
- reload subscription by url
Expected behavior
Hysteria subscription generation should work correctly when the optional udpHop field is missing or set to None.
Since udpHop is optional, subscription generators should handle its absence gracefully instead of raising an AttributeError.
Both links.py and clash.py should generate valid Hysteria configurations without requiring udpHop to be explicitly configured.
Logs and error messages
**Error in `links.py`:**
File "/code/app/subscription/links.py", line 327, in _build_hysteria
payload["mports"] = quic_params.get("udpHop", {}).get("ports", "")
AttributeError: 'NoneType' object has no attribute 'get'
**Error in `clash.py`:**
File "/code/app/subscription/clash.py", line 697, in _build_hysteria
node["ports"] = quic_params.get("udpHop", {}).get("ports", "")
AttributeError: 'NoneType' object has no attribute 'get'
**Cause:**
The optional `udpHop` field is `None`, but both subscription generators attempt to call `.get("ports")` on it.Environment
OS: Linux
Database: PostgreSQL
Relevant configuration
Screenshots or videos
No response
Additional context
No response
Activity
[-][Bug]:[/-][+][Bug] Hysteria subscription generation fails when udpHop is None[/+]fix(subscription): build Hysteria2 hosts whose FinalMask has no udp m…
T3ST3ST3R0N commentedon Oct 10, 2026
Thanks for the detailed report. The case you described is fixed on dev by #974, and #993 fixes the remaining shapes (a Hysteria FinalMask with quicParams but no udp mask). Both ship in the next release.
fix(subscription): build Hysteria2 hosts whose FinalMask has no udp m…
fix(subscription): build Hysteria2 hosts whose FinalMask has no udp m…