[GH-ISSUE #5829] [Bug]: Pressing Enter for default ACME port shows an incorrect error message #4049

Closed
opened 2026-10-31 20:36:47 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @dimadr on GitHub (Jul 6, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5829

Describe the bug

When issuing a TLS certificate, the installer asks:

Please choose which port to use (default is 80):

If the user simply presses Enter to accept the default port, the script displays:

[ERR] Your input is invalid, will use default port 80.

The behavior is correct (port 80 is used), but the message is misleading.

Accepting the default value is a normal workflow and should not be reported as an error.

How to reproduce the problem

  1. Start the certificate issuance process.
  2. Enter a valid domain.
  3. When prompted:
Please choose which port to use (default is 80):
  1. Press Enter without typing a port.

The installer uses port 80 but prints:

[ERR] Your input is invalid, will use default port 80.

Expected behavior

Pressing Enter should accept the default port without showing an error.

Expected output could be:

[INF] Will use port: 80

or:

[INF] Using default port: 80

Actual behavior

Pressing Enter accepts the default port 80, but the installer prints an error message:

[ERR] Your input is invalid, will use default port 80.

This is misleading because empty input means accepting the default value.

Relevant logs


Screenshots

Image

3x-ui version

3.4.2

Xray-core version

26.6.27

How did you install 3x-ui?

install.sh script

Operating system

Debian 13.5

Which parts of the panel are affected?

Other

Browser (only if it is a UI bug)

Not applicable

Is the panel behind a reverse proxy or CDN?

No — direct access

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 @dimadr on GitHub (Jul 6, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5829 ### Describe the bug When issuing a TLS certificate, the installer asks: ```text Please choose which port to use (default is 80): ``` If the user simply presses **Enter** to accept the default port, the script displays: ```text [ERR] Your input is invalid, will use default port 80. ``` The behavior is correct (port 80 is used), but the message is misleading. Accepting the default value is a normal workflow and should not be reported as an error. ### How to reproduce the problem 1. Start the certificate issuance process. 2. Enter a valid domain. 3. When prompted: ```text Please choose which port to use (default is 80): ``` 4. Press **Enter** without typing a port. The installer uses port 80 but prints: ```text [ERR] Your input is invalid, will use default port 80. ``` ### Expected behavior Pressing Enter should accept the default port without showing an error. Expected output could be: [INF] Will use port: 80 or: [INF] Using default port: 80 ### Actual behavior Pressing Enter accepts the default port 80, but the installer prints an error message: [ERR] Your input is invalid, will use default port 80. This is misleading because empty input means accepting the default value. ### Relevant logs ```shell ``` ### Screenshots <img width="549" height="364" alt="Image" src="https://github.com/user-attachments/assets/7fae6843-1bab-43b9-82f6-167f25d17e8e" /> ### 3x-ui version 3.4.2 ### Xray-core version 26.6.27 ### How did you install 3x-ui? install.sh script ### Operating system Debian 13.5 ### Which parts of the panel are affected? Other ### Browser (only if it is a UI bug) Not applicable ### Is the panel behind a reverse proxy or CDN? No — direct access ### 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:36:47 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jul 6, 2026):

Confirmed in the source. The port-validation check treats an empty response (pressing Enter to accept the default) the same as an out-of-range number.

In x-ui.sh, ssl_cert_issue():

local WebPort=80
read -rp "Please choose which port to use (default is 80): " WebPort
if [[ ${WebPort} -gt 65535 || ${WebPort} -lt 1 ]]; then
    LOGE "Your input ${WebPort} is invalid, will use default port 80."
    WebPort=80
fi

When WebPort is empty, bash's arithmetic comparison evaluates the empty string as 0, so ${WebPort} -lt 1 is true and the LOGE ([ERR]) branch fires even though nothing invalid was entered — the pre-set WebPort=80 default was simply left untouched. The fix used for the rest of the port ultimately works, just the message is wrong.

The same pattern exists in two other places with the identical prompt and check:

  • install.sh:681-685 (prompt_or_default WebPort ..., then the same -gt/-lt check)
  • update.sh:500-504 (plain read -rp, same check)

All three would need the guard to distinguish "empty input" (accept default, log as info) from "non-numeric or out-of-range input" (log as error), e.g. by checking [[ -z "${WebPort}" ]] separately before the numeric range check.

This is a cosmetic/log-message issue only — the resulting port (80) is correct in all cases.

This reply was generated automatically. A maintainer may follow up with further questions or feedback.

<!-- gh-comment-id:4890817077 --> @github-actions[bot] commented on GitHub (Jul 6, 2026): Confirmed in the source. The port-validation check treats an empty response (pressing Enter to accept the default) the same as an out-of-range number. In `x-ui.sh`, `ssl_cert_issue()`: ```bash local WebPort=80 read -rp "Please choose which port to use (default is 80): " WebPort if [[ ${WebPort} -gt 65535 || ${WebPort} -lt 1 ]]; then LOGE "Your input ${WebPort} is invalid, will use default port 80." WebPort=80 fi ``` When `WebPort` is empty, bash's arithmetic comparison evaluates the empty string as `0`, so `${WebPort} -lt 1` is true and the `LOGE` (`[ERR]`) branch fires even though nothing invalid was entered — the pre-set `WebPort=80` default was simply left untouched. The fix used for the rest of the port ultimately works, just the message is wrong. The same pattern exists in two other places with the identical prompt and check: - `install.sh:681-685` (`prompt_or_default WebPort ...`, then the same `-gt`/`-lt` check) - `update.sh:500-504` (plain `read -rp`, same check) All three would need the guard to distinguish "empty input" (accept default, log as info) from "non-numeric or out-of-range input" (log as error), e.g. by checking `[[ -z "${WebPort}" ]]` separately before the numeric range check. This is a cosmetic/log-message issue only — the resulting port (80) is correct in all cases. *This reply was generated automatically. A maintainer may follow up with further questions or feedback.*
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#4049
No description provided.