[GH-ISSUE #6388] [Bug]: QR-code for AWG inbound (config type, not native Amnezia WG vpn://) cannot be scanned\invalid #4334

Closed
opened 2026-10-31 20:38:55 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @1nn0 on GitHub (Sep 2, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6388

Describe the bug

When I try to scan AWG 3.1 QR-code (config type) in, for example, WG Tunnel app (Android). The result is error or not scannig at all. Tested on a bunch of Android phones with WG Tunnel app (v5.6.0).

3x UI [latest, docker]
WG Tunnel APP [5.6.0]

How to reproduce the problem

  1. Open AWG QR-Codes
  2. Choose bottom variant (config)
  3. Try to scan with third-party app, WG tunnel in particular.
  4. Get error as a result OR no result at all

Expected behavior

Successfully add tunnel via QR-Code

Actual behavior

Error or no result

Relevant logs


Screenshots

No response

3x-ui version

3.7.0

Xray-core version

26.7.28

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Debian 13

Which parts of the panel are affected?

Other

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

Yes — Nginx

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @1nn0 on GitHub (Sep 2, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6388 ### Describe the bug When I try to scan AWG 3.1 QR-code (config type) in, for example, WG Tunnel app (Android). The result is error or not scannig at all. Tested on a bunch of Android phones with WG Tunnel app (v5.6.0). 3x UI [latest, docker] WG Tunnel APP [5.6.0] ### How to reproduce the problem 1) Open AWG QR-Codes 2) Choose bottom variant (config) 3) Try to scan with third-party app, WG tunnel in particular. 4) Get error as a result OR no result at all ### Expected behavior Successfully add tunnel via QR-Code ### Actual behavior Error or no result ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.7.0 ### Xray-core version 26.7.28 ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Debian 13 ### Which parts of the panel are affected? Other ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? Yes — Nginx ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:38:55 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Sep 2, 2026):

The QR code itself is fine — the panel puts the exact plain-text .conf into it, unmodified and untruncated. What almost certainly fails is the import on the WG Tunnel side: the config the panel generates by default carries AmneziaWG 3.1-only keys, and a client build that doesn't implement 3.1 rejects the whole config as invalid when it parses it.

Why I think that's what you're hitting

QrPanel hands the value straight to Ant Design's <QRCode> with no transform (frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147), and the value is the .conf text built by genAmneziaWGConfig (frontend/src/lib/xray/inbound-link.ts:958-1028), whose shape is pinned to wg-quick(8) field order by amneziawg-conf-parity.test.ts:83-94.

With the panel's generated obfuscation set, that text always includes these lines (inbound-link.ts:994-1012):

I1 = <r 148>
HeaderProtectionKey = <base64 32 bytes>
ContentPaddingAddition = 17-49
RekeyAfterTime = 111-139
RekeyTimeout = 4-7
RejectAfterTime = 187-251
KeepaliveTimeout = 9-14
MaxHandshakeAttempts = 19-36
RandomTrailers = on
DisableCookies = on

They are always present because the generator fills them unconditionally — i1: '<r …>', headerProtectionKey, randomTrailers: true, disableCookies: true (frontend/src/lib/xray/amneziawg-obfuscation.ts:110-123). The panel's own field hint says it plainly: "randomTrailersHint": "Appends random bytes to every packet. Both ends need AmneziaWG 3.1+." (internal/web/translation/en-US.json:1960), and the docs carry the same warning — "The 3.1 parameters need a 3.1-capable client… blanking the 3.1 fields renders a config older clients still understand" (docs/content/docs/en/config/amneziawg.mdx:64-70).

Supporting point on the "too dense to scan" theory: the vpn:// variant is nothing but base64url of that same .conf, with no compression (inbound-link.ts:932-937 and :948-951), so it is ~33% more data than the config QR — and both render through the same <QRCode> component, at 220 px in the popovers (ConfigBlock.tsx:56, SubPage.tsx:568-575). A strictly larger payload scanning while the smaller one doesn't points at the parser, not at the encoding. (This rests on the assumption, from your title, that the vpn:// QR does scan for you — say so if that's wrong.)

The one check that settles it

Both failure modes look the same from the camera, so please bypass the camera entirely:

  1. In the same panel, click the download button next to that config (QrPanel.tsx:117-126 — it saves peer-N.conf / <email>.conf; byte-for-byte what the QR encodes).
  2. Import that file into WG Tunnel.
  3. If the file import fails too → it's the client's config parser, and the fix is on your side (below). If the file imports fine and only the QR fails → the QR decode is the problem and that's ours; reply here with that result.

Workaround if the file import also fails

Edit the AmneziaWG inbound and clear the 3.1 fields, then regenerate the client configs. All of these are plain text inputs / switches (frontend/src/pages/inbounds/form/protocols/amneziawg.tsx:133-213), so they can be emptied:

  • Blank I1–I5, HeaderProtectionKey, ContentPaddingAddition, RekeyAfterTime, RekeyTimeout, RejectAfterTime, KeepaliveTimeout, MaxHandshakeAttempts
  • Set S3 = 0 and S4 = 0 (a zero drops the line — inbound-link.ts:988-989)
  • Turn off RandomTrailers and DisableCookies

That leaves only Jc/Jmin/Jmax/S1/S2/H1-H4, which pre-3.1 clients understand. It also shrinks the payload noticeably, which helps scanning as a side effect.

⚠️ These values are part of the wire protocol, so changing them breaks every already-deployed client of that inbound — everyone has to re-import.

I could not read WG Tunnel's parser from here, so I can't tell you which exact key it chokes on; the error text WG Tunnel shows (as text, not a screenshot) would name it.

Verdict: Not a bug (user configuration)
Severity: N/A
Confidence: Medium
Root cause: No panel-side defect found. The QR payload is the unmodified .conf (frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147), and that .conf legitimately contains AmneziaWG 3.1 keys emitted unconditionally by genAmneziaWGConfig (frontend/src/lib/xray/inbound-link.ts:994-1012) from generateAwgObfuscation()'s defaults (frontend/src/lib/xray/amneziawg-obfuscation.ts:110-123). A client that does not implement 3.1 rejects the config on import — documented at docs/content/docs/en/config/amneziawg.mdx:64-70.
Already fixed: Not applicable — AmneziaWG landed in effcccce ("feat(amneziawg): add native AmneziaWG protocol support (#6105)"), which git tag --contains puts in v3.7.0, the reporter's version; nothing in these files has changed since.
Duplicate of: None
Evidence: QrPanel.tsx:141 value={value} — no transform between the .conf and the QR. inbound-link.ts:1011-1012 if (server.randomTrailers) txt += 'RandomTrailers = on\n' / if (server.disableCookies) txt += 'DisableCookies = on\n'. amneziawg-obfuscation.ts:122-123 randomTrailers: true, disableCookies: true. internal/web/translation/en-US.json:1960 "Both ends need AmneziaWG 3.1+." docs/content/docs/en/config/amneziawg.mdx:64-70 warn callout. inbound-link.ts:932-937 + :948-951 — vpn:// is uncompressed base64url of the same text, i.e. a strictly larger QR payload. amneziawg-conf-parity.test.ts:83-94 pins the emitted .conf to wg-quick field order with no trailing newline. Size: sed -n '133,164p' docs/content/docs/en/config/amneziawg.mdx | wc -c → 663 bytes for the documented example; a real one is roughly 50-120 bytes larger once the placeholder keys become 44-char base64 keys and the MTU/PresharedKey lines appear.
Not determined: Whether WG Tunnel decoded the QR and rejected the config, or failed to decode it at all — I cannot run the panel or a scanner, and I could not read WG Tunnel's source from here. Step 2 above (importing the downloaded .conf file, same bytes, no camera) settles it in one try.

Leaving this open with clarification needed until that result comes back.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5508882147 --> @github-actions[bot] commented on GitHub (Sep 2, 2026): The QR code itself is fine — the panel puts the **exact plain-text `.conf`** into it, unmodified and untruncated. What almost certainly fails is the *import* on the WG Tunnel side: the config the panel generates by default carries AmneziaWG **3.1-only** keys, and a client build that doesn't implement 3.1 rejects the whole config as invalid when it parses it. ### Why I think that's what you're hitting `QrPanel` hands the value straight to Ant Design's `<QRCode>` with no transform (`frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147`), and the value is the `.conf` text built by `genAmneziaWGConfig` (`frontend/src/lib/xray/inbound-link.ts:958-1028`), whose shape is pinned to wg-quick(8) field order by `amneziawg-conf-parity.test.ts:83-94`. With the panel's generated obfuscation set, that text always includes these lines (`inbound-link.ts:994-1012`): ``` I1 = <r 148> HeaderProtectionKey = <base64 32 bytes> ContentPaddingAddition = 17-49 RekeyAfterTime = 111-139 RekeyTimeout = 4-7 RejectAfterTime = 187-251 KeepaliveTimeout = 9-14 MaxHandshakeAttempts = 19-36 RandomTrailers = on DisableCookies = on ``` They are always present because the generator fills them unconditionally — `i1: '<r …>'`, `headerProtectionKey`, `randomTrailers: true`, `disableCookies: true` (`frontend/src/lib/xray/amneziawg-obfuscation.ts:110-123`). The panel's own field hint says it plainly: `"randomTrailersHint": "Appends random bytes to every packet. Both ends need AmneziaWG 3.1+."` (`internal/web/translation/en-US.json:1960`), and the docs carry the same warning — *"The 3.1 parameters need a 3.1-capable client… blanking the 3.1 fields renders a config older clients still understand"* (`docs/content/docs/en/config/amneziawg.mdx:64-70`). Supporting point on the "too dense to scan" theory: the `vpn://` variant is nothing but base64url of that same `.conf`, with no compression (`inbound-link.ts:932-937` and `:948-951`), so it is **~33% more data** than the config QR — and both render through the same `<QRCode>` component, at 220 px in the popovers (`ConfigBlock.tsx:56`, `SubPage.tsx:568-575`). A strictly larger payload scanning while the smaller one doesn't points at the parser, not at the encoding. (This rests on the assumption, from your title, that the `vpn://` QR does scan for you — say so if that's wrong.) ### The one check that settles it Both failure modes look the same from the camera, so please bypass the camera entirely: 1. In the same panel, click the **download** button next to that config (`QrPanel.tsx:117-126` — it saves `peer-N.conf` / `<email>.conf`; byte-for-byte what the QR encodes). 2. Import that **file** into WG Tunnel. 3. If the file import fails too → it's the client's config parser, and the fix is on your side (below). If the file imports fine and only the QR fails → the QR decode is the problem and that's ours; reply here with that result. ### Workaround if the file import also fails Edit the AmneziaWG inbound and clear the 3.1 fields, then regenerate the client configs. All of these are plain text inputs / switches (`frontend/src/pages/inbounds/form/protocols/amneziawg.tsx:133-213`), so they can be emptied: - Blank `I1`–`I5`, `HeaderProtectionKey`, `ContentPaddingAddition`, `RekeyAfterTime`, `RekeyTimeout`, `RejectAfterTime`, `KeepaliveTimeout`, `MaxHandshakeAttempts` - Set `S3 = 0` and `S4 = 0` (a zero drops the line — `inbound-link.ts:988-989`) - Turn **off** `RandomTrailers` and `DisableCookies` That leaves only `Jc/Jmin/Jmax/S1/S2/H1-H4`, which pre-3.1 clients understand. It also shrinks the payload noticeably, which helps scanning as a side effect. ⚠️ These values are part of the wire protocol, so changing them breaks every already-deployed client of that inbound — everyone has to re-import. I could not read WG Tunnel's parser from here, so I can't tell you which exact key it chokes on; the error text WG Tunnel shows (as text, not a screenshot) would name it. Verdict: Not a bug (user configuration) Severity: N/A Confidence: Medium Root cause: No panel-side defect found. The QR payload is the unmodified `.conf` (`frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147`), and that `.conf` legitimately contains AmneziaWG 3.1 keys emitted unconditionally by `genAmneziaWGConfig` (`frontend/src/lib/xray/inbound-link.ts:994-1012`) from `generateAwgObfuscation()`'s defaults (`frontend/src/lib/xray/amneziawg-obfuscation.ts:110-123`). A client that does not implement 3.1 rejects the config on import — documented at `docs/content/docs/en/config/amneziawg.mdx:64-70`. Already fixed: Not applicable — AmneziaWG landed in effcccce ("feat(amneziawg): add native AmneziaWG protocol support (#6105)"), which `git tag --contains` puts in v3.7.0, the reporter's version; nothing in these files has changed since. Duplicate of: None Evidence: `QrPanel.tsx:141` `value={value}` — no transform between the `.conf` and the QR. `inbound-link.ts:1011-1012` `if (server.randomTrailers) txt += 'RandomTrailers = on\n'` / `if (server.disableCookies) txt += 'DisableCookies = on\n'`. `amneziawg-obfuscation.ts:122-123` `randomTrailers: true, disableCookies: true`. `internal/web/translation/en-US.json:1960` "Both ends need AmneziaWG 3.1+." `docs/content/docs/en/config/amneziawg.mdx:64-70` warn callout. `inbound-link.ts:932-937` + `:948-951` — `vpn://` is uncompressed base64url of the same text, i.e. a strictly larger QR payload. `amneziawg-conf-parity.test.ts:83-94` pins the emitted `.conf` to wg-quick field order with no trailing newline. Size: `sed -n '133,164p' docs/content/docs/en/config/amneziawg.mdx | wc -c` → 663 bytes for the documented example; a real one is roughly 50-120 bytes larger once the placeholder keys become 44-char base64 keys and the `MTU`/`PresharedKey` lines appear. Not determined: Whether WG Tunnel decoded the QR and rejected the config, or failed to decode it at all — I cannot run the panel or a scanner, and I could not read WG Tunnel's source from here. Step 2 above (importing the downloaded `.conf` file, same bytes, no camera) settles it in one try. Leaving this open with **clarification needed** until that result comes back. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@1nn0 commented on GitHub (Sep 2, 2026):

Import from .conf file works fine.
I tried to save QR-Code image to my pc, then opened it in viewer and zoomed in. Same result when I try to scan it.
But when I Disable "DisableCookies" parameter (only this one) - QR-Code scans just fine.
A assume, that somehow this setting is breaking QR-Code generation.

<!-- gh-comment-id:5509670075 --> @1nn0 commented on GitHub (Sep 2, 2026): Import from .conf file works fine. I tried to save QR-Code image to my pc, then opened it in viewer and zoomed in. Same result when I try to scan it. But when I Disable "DisableCookies" parameter (only this one) - QR-Code scans just fine. A assume, that somehow this setting is breaking QR-Code generation.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 2, 2026):

Thanks — that A/B test settles it, and it points at us, not at WG Tunnel. Confirmed bug. Your .conf file importing fine rules out my earlier theory (a 3.1 key the client rejects); the content is valid, so what fails is the QR image itself. DisableCookies isn't special — dropping that one line just shortens the payload by 20 bytes, and the panel renders every QR into a fixed pixel box regardless of how much data is in it, so an AmneziaWG .conf sits right on the edge of what a camera can decode and 20 bytes tips it over.

What the code does

QrPanel passes the payload straight to antd's <QRCode> with a hardcoded pixel size and no error-correction override (frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147):

<QRCode
  className="qr-code"
  value={value}
  size={size}          // size = 360 default (QrPanel.tsx:62); 220 at ConfigBlock.tsx:56 and ClientInfoModal.tsx:764
  type="svg"
  bordered={false}
  color="#000000"
  bgColor="#ffffff"
/>

Nothing between the .conf text and that size looks at the payload length. Compare the one place the codebase does tune a QR — the 2FA code at frontend/src/pages/settings/TwoFactorModal.tsx:133 explicitly sets errorLevel="L"; QrPanel never does, so the share-link/config QR runs at antd's default (higher error correction ⇒ more modules for the same data).

The AmneziaWG .conf is by far the largest thing the panel puts in a QR, because genAmneziaWGConfig emits the whole 3.1 parameter set unconditionally (frontend/src/lib/xray/inbound-link.ts:994-1012), fed by generateAwgObfuscation()'s defaults (amneziawg-obfuscation.ts:110-123). Adding up those lines by hand for a typical inbound (44-char keys, two DNS servers, PSK, a hostname endpoint) comes out around 780 bytes — the exact number depends on your key/DNS/endpoint values, so treat it as an estimate, not a measured figure. A payload that size needs a symbol on the order of 105–110 modules per side at the default error-correction level (QR capacity/version figures are ISO/IEC 18004, not something in this repo — that part is inference). Rendered into a 360 px box that is roughly 3.3 px per module, which is about where phone decoders start failing. Each QR version step adds 4 modules and re-lays the entire symbol, which is exactly why removing one 20-byte line flips it from "no result" to "scans fine".

Why saving the image and zooming didn't help

That is the same defect, and it's the clearest source-level confirmation. The image export rasterises the vector QR at exactly the same fixed size (QrPanel.tsx:26-37, called with size at :93):

canvas.width = size;
canvas.height = size;
ctx.fillStyle = '#ffffff';
ctx.fillRect(0, 0, size, size);
ctx.drawImage(img, 0, 0, size, size);

So the PNG you saved is 360×360 px no matter how many modules are in it, and it's drawn edge-to-edge with no margin added. Zooming in a viewer just enlarges those ~3.3 px blocks and their anti-aliasing — it cannot add detail.

Workarounds until this is addressed

  1. Scan off the screen with the browser zoomed in. The on-screen QR is an SVG constrained by max-width: 360px in CSS pixels (frontend/src/pages/inbounds/qr/QrPanel.css:35-39), so browser page zoom (Ctrl/Cmd + +) renders it physically larger and still crisp, unlike the downloaded PNG. Try 200%.
  2. Keep using the .conf download — you've already confirmed it works, and it's byte-for-byte the same config.
  3. Open the QR from the inbound's QR modal rather than the 220 px popovers (ConfigBlock.tsx:56, ClientInfoModal.tsx:764), which are ~40% smaller for the same data.

I'd avoid the "blank the 3.1 fields" workaround I mentioned earlier purely to shrink the QR — those values are part of the wire protocol and changing them forces every already-deployed client of that inbound to re-import.

Verdict: Confirmed bug
Severity: High
Confidence: Medium
Root cause: QrPanel (frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147) renders the QR at a fixed size (360 default at :62, 220 at ConfigBlock.tsx:56 / ClientInfoModal.tsx:764) and never sets errorLevel, so module density scales with payload length while pixel size does not. svgToPngBlob (QrPanel.tsx:18-47, invoked at :81 and :93) rasterises the export at that same fixed size, so downloading and zooming cannot recover the lost resolution. Triggered by any payload large enough to need a high-version symbol — in practice the AmneziaWG .conf, whose 3.1 lines genAmneziaWGConfig emits unconditionally (frontend/src/lib/xray/inbound-link.ts:994-1012) from generateAwgObfuscation()'s always-on defaults (amneziawg-obfuscation.ts:110-123, randomTrailers: true, disableCookies: true).
Already fixed: Still present on the default branch. git log -- frontend/src/pages/inbounds/qr/QrPanel.tsx shows nothing since AmneziaWG landed that touches sizing (latest: b9eda09d, 92fb94d8, 71aca201, d1882c7f — dependency/lint/a11y/tree-reorg work).
Duplicate of: None. Related: 5d0081a3 "fix(qr): hide QR for post-quantum links on client QR page" (Closes #4656) — same underlying gap ("the encoded URL exceeds the antd QRCode capacity"), but it was solved with a payload-content heuristic, isPostQuantumLink() (inbound-link.ts:1580-1585), which matches pqv= / mlkem768 / mldsa65 / ML-KEM-768 and therefore never fires for a .conf.
Evidence: QrPanel.tsx:142 size={size} with size = 360 at :62 — no dependence on value.length anywhere in the file. QrPanel.tsx:27-28,36-37 canvas.width = size / ctx.drawImage(img, 0, 0, size, size) — export resolution is fixed and the symbol fills the canvas. TwoFactorModal.tsx:133 errorLevel="L" — the prop exists and is used deliberately elsewhere, but not in QrPanel. QrPanel.css:35-39 width: 100%; height: auto; max-width: 360px. inbound-link.ts:1011-1012 if (server.randomTrailers) txt += 'RandomTrailers = on\n' / if (server.disableCookies) txt += 'DisableCookies = on\n' — the 20 bytes the reporter removed. Reporter's own A/B: file import of the identical bytes succeeds, only the QR fails, and a 20-byte payload reduction fixes the QR.
Not determined: I cannot run a decoder or the panel here, so the precise decode failure mode (module density vs. quiet zone vs. raster anti-aliasing) is inferred, not measured. The single check that would settle it: render the same .conf at size={720} (or with errorLevel="L") and scan it — if it decodes, it is purely density.

Suggested fix: derive the QR pixel size (and the svgToPngBlob raster size) from value.length in QrPanel, so a ~800-byte .conf gets a proportionally larger symbol instead of the same 360 px box. Dropping to errorLevel="L" for large payloads, as TwoFactorModal.tsx:133 already does, cuts the module count for the same data and is the cheaper half of the change. The 220 px popover call sites (ConfigBlock.tsx:56, ClientInfoModal.tsx:764) need the same treatment or they will stay unscannable regardless.

@MHSanaei

I've removed the clarification needed label — the reply gave everything needed.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5509760111 --> @github-actions[bot] commented on GitHub (Sep 2, 2026): Thanks — that A/B test settles it, and it points at us, not at WG Tunnel. **Confirmed bug.** Your `.conf` file importing fine rules out my earlier theory (a 3.1 key the client rejects); the content is valid, so what fails is the *QR image itself*. `DisableCookies` isn't special — dropping that one line just shortens the payload by 20 bytes, and the panel renders every QR into a **fixed pixel box regardless of how much data is in it**, so an AmneziaWG `.conf` sits right on the edge of what a camera can decode and 20 bytes tips it over. ### What the code does `QrPanel` passes the payload straight to antd's `<QRCode>` with a hardcoded pixel size and no error-correction override (`frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147`): ```tsx <QRCode className="qr-code" value={value} size={size} // size = 360 default (QrPanel.tsx:62); 220 at ConfigBlock.tsx:56 and ClientInfoModal.tsx:764 type="svg" bordered={false} color="#000000" bgColor="#ffffff" /> ``` Nothing between the `.conf` text and that `size` looks at the payload length. Compare the one place the codebase *does* tune a QR — the 2FA code at `frontend/src/pages/settings/TwoFactorModal.tsx:133` explicitly sets `errorLevel="L"`; `QrPanel` never does, so the share-link/config QR runs at antd's default (higher error correction ⇒ more modules for the same data). The AmneziaWG `.conf` is by far the largest thing the panel puts in a QR, because `genAmneziaWGConfig` emits the whole 3.1 parameter set unconditionally (`frontend/src/lib/xray/inbound-link.ts:994-1012`), fed by `generateAwgObfuscation()`'s defaults (`amneziawg-obfuscation.ts:110-123`). Adding up those lines by hand for a typical inbound (44-char keys, two DNS servers, PSK, a hostname endpoint) comes out around **780 bytes** — the exact number depends on your key/DNS/endpoint values, so treat it as an estimate, not a measured figure. A payload that size needs a symbol on the order of 105–110 modules per side at the default error-correction level *(QR capacity/version figures are ISO/IEC 18004, not something in this repo — that part is inference)*. Rendered into a 360 px box that is roughly **3.3 px per module**, which is about where phone decoders start failing. Each QR version step adds 4 modules and re-lays the entire symbol, which is exactly why removing one 20-byte line flips it from "no result" to "scans fine". ### Why saving the image and zooming didn't help That is the same defect, and it's the clearest source-level confirmation. The image export rasterises the vector QR at exactly the same fixed `size` (`QrPanel.tsx:26-37`, called with `size` at `:93`): ```js canvas.width = size; canvas.height = size; ctx.fillStyle = '#ffffff'; ctx.fillRect(0, 0, size, size); ctx.drawImage(img, 0, 0, size, size); ``` So the PNG you saved is 360×360 px no matter how many modules are in it, and it's drawn edge-to-edge with no margin added. Zooming in a viewer just enlarges those ~3.3 px blocks and their anti-aliasing — it cannot add detail. ### Workarounds until this is addressed 1. **Scan off the screen with the browser zoomed in.** The on-screen QR is an SVG constrained by `max-width: 360px` in CSS pixels (`frontend/src/pages/inbounds/qr/QrPanel.css:35-39`), so browser page zoom (Ctrl/Cmd + `+`) renders it physically larger *and* still crisp, unlike the downloaded PNG. Try 200%. 2. **Keep using the `.conf` download** — you've already confirmed it works, and it's byte-for-byte the same config. 3. Open the QR from the inbound's QR modal rather than the 220 px popovers (`ConfigBlock.tsx:56`, `ClientInfoModal.tsx:764`), which are ~40% smaller for the same data. I'd avoid the "blank the 3.1 fields" workaround I mentioned earlier purely to shrink the QR — those values are part of the wire protocol and changing them forces every already-deployed client of that inbound to re-import. Verdict: Confirmed bug Severity: High Confidence: Medium Root cause: `QrPanel` (`frontend/src/pages/inbounds/qr/QrPanel.tsx:139-147`) renders the QR at a fixed `size` (360 default at `:62`, 220 at `ConfigBlock.tsx:56` / `ClientInfoModal.tsx:764`) and never sets `errorLevel`, so module density scales with payload length while pixel size does not. `svgToPngBlob` (`QrPanel.tsx:18-47`, invoked at `:81` and `:93`) rasterises the export at that same fixed `size`, so downloading and zooming cannot recover the lost resolution. Triggered by any payload large enough to need a high-version symbol — in practice the AmneziaWG `.conf`, whose 3.1 lines `genAmneziaWGConfig` emits unconditionally (`frontend/src/lib/xray/inbound-link.ts:994-1012`) from `generateAwgObfuscation()`'s always-on defaults (`amneziawg-obfuscation.ts:110-123`, `randomTrailers: true, disableCookies: true`). Already fixed: Still present on the default branch. `git log -- frontend/src/pages/inbounds/qr/QrPanel.tsx` shows nothing since AmneziaWG landed that touches sizing (latest: b9eda09d, 92fb94d8, 71aca201, d1882c7f — dependency/lint/a11y/tree-reorg work). Duplicate of: None. Related: 5d0081a3 "fix(qr): hide QR for post-quantum links on client QR page" (Closes #4656) — same underlying gap ("the encoded URL exceeds the antd QRCode capacity"), but it was solved with a payload-*content* heuristic, `isPostQuantumLink()` (`inbound-link.ts:1580-1585`), which matches `pqv=` / `mlkem768` / `mldsa65` / `ML-KEM-768` and therefore never fires for a `.conf`. Evidence: `QrPanel.tsx:142` `size={size}` with `size = 360` at `:62` — no dependence on `value.length` anywhere in the file. `QrPanel.tsx:27-28,36-37` `canvas.width = size` / `ctx.drawImage(img, 0, 0, size, size)` — export resolution is fixed and the symbol fills the canvas. `TwoFactorModal.tsx:133` `errorLevel="L"` — the prop exists and is used deliberately elsewhere, but not in `QrPanel`. `QrPanel.css:35-39` `width: 100%; height: auto; max-width: 360px`. `inbound-link.ts:1011-1012` `if (server.randomTrailers) txt += 'RandomTrailers = on\n'` / `if (server.disableCookies) txt += 'DisableCookies = on\n'` — the 20 bytes the reporter removed. Reporter's own A/B: file import of the identical bytes succeeds, only the QR fails, and a 20-byte payload reduction fixes the QR. Not determined: I cannot run a decoder or the panel here, so the precise decode failure mode (module density vs. quiet zone vs. raster anti-aliasing) is inferred, not measured. The single check that would settle it: render the same `.conf` at `size={720}` (or with `errorLevel="L"`) and scan it — if it decodes, it is purely density. Suggested fix: derive the QR pixel size (and the `svgToPngBlob` raster size) from `value.length` in `QrPanel`, so a ~800-byte `.conf` gets a proportionally larger symbol instead of the same 360 px box. Dropping to `errorLevel="L"` for large payloads, as `TwoFactorModal.tsx:133` already does, cuts the module count for the same data and is the cheaper half of the change. The 220 px popover call sites (`ConfigBlock.tsx:56`, `ClientInfoModal.tsx:764`) need the same treatment or they will stay unscannable regardless. @MHSanaei I've removed the **clarification needed** label — the reply gave everything needed. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@dawNotPoi commented on GitHub (Sep 3, 2026):

I'd like to take this issue.

The reporter's file-import and single-line A/B results isolate the problem to QR readability rather than the generated AWG configuration. I reproduced the same QR version boundary with a representative full AWG 3.1 config: the current default correction level and zero quiet zone produce a 109-module symbol, while the 20-byte reduction falls to 105 modules.

I plan to keep the change focused in the shared QR panel: use the lower correction level already used by the project's 2FA QR and add the standard four-module quiet zone. I will add a regression test using a real generated AWG config to pin both the resulting grid size and quiet zone, without changing the config contents or introducing payload-length heuristics.

<!-- gh-comment-id:5519727746 --> @dawNotPoi commented on GitHub (Sep 3, 2026): I'd like to take this issue. The reporter's file-import and single-line A/B results isolate the problem to QR readability rather than the generated AWG configuration. I reproduced the same QR version boundary with a representative full AWG 3.1 config: the current default correction level and zero quiet zone produce a 109-module symbol, while the 20-byte reduction falls to 105 modules. I plan to keep the change focused in the shared QR panel: use the lower correction level already used by the project's 2FA QR and add the standard four-module quiet zone. I will add a regression test using a real generated AWG config to pin both the resulting grid size and quiet zone, without changing the config contents or introducing payload-length heuristics.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4334
No description provided.