[GH-ISSUE #2908] strata_bench.py: NameError: name 'port' is not defined when it starts the server itself (0.1.45, since #2330) #1174

Closed
opened 2026-11-04 01:49:06 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @K8nsch on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2908

What happens

With no Strata server running, tools\strata_bench.py --config strata-iq3_s.json --long stops at once:

  File "C:\Tools\Strata\tools\strata_bench.py", line 990, in main
    say(f"Starting {cfg_path.name} on port {port} (loading takes 1-3 minutes; the PC may be slow meanwhile) ...")
NameError: name 'port' is not defined

Cause

69fe4055 (#2330, PR #2362) replaced

port = a.port or int(cfg.get("port", 8080))
base = f"http://127.0.0.1:{port}"

with base = server_base(cfg.get("host"), a.port or int(cfg.get("port", 8080))), so port is no longer bound, but lines 987, 990 and 991 (start_server(cfg_path, port, ...)) still use it. Only the path where the bench starts the server is affected; against a running server (or with --url) it works.

Fix (suggestion)

port = a.port or int(cfg.get("port", 8080))
base = server_base(cfg.get("host"), port)

(port is only needed in the branch with a config, which is the only branch that reaches line 987.)

Setup: Windows 11, 0.1.45 release zip (strata-windows-x64.zip), repo at 477ac13c. Worked around by starting the server first; the bench then uses the running server.

Originally created by @K8nsch on GitHub (Oct 17, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/2908 **What happens** With no Strata server running, `tools\strata_bench.py --config strata-iq3_s.json --long` stops at once: ``` File "C:\Tools\Strata\tools\strata_bench.py", line 990, in main say(f"Starting {cfg_path.name} on port {port} (loading takes 1-3 minutes; the PC may be slow meanwhile) ...") NameError: name 'port' is not defined ``` **Cause** 69fe4055 (#2330, PR #2362) replaced ```python port = a.port or int(cfg.get("port", 8080)) base = f"http://127.0.0.1:{port}" ``` with `base = server_base(cfg.get("host"), a.port or int(cfg.get("port", 8080)))`, so `port` is no longer bound, but lines 987, 990 and 991 (`start_server(cfg_path, port, ...)`) still use it. Only the path where the bench starts the server is affected; against a running server (or with `--url`) it works. **Fix (suggestion)** ```python port = a.port or int(cfg.get("port", 8080)) base = server_base(cfg.get("host"), port) ``` (`port` is only needed in the branch with a config, which is the only branch that reaches line 987.) **Setup:** Windows 11, 0.1.45 release zip (`strata-windows-x64.zip`), repo at 477ac13c. Worked around by starting the server first; the bench then uses the running server.
Author
Owner

@Gerporgl commented on GitHub (Oct 17, 2026):

+1 I also have the same issue.

<!-- gh-comment-id:6235381815 --> @Gerporgl commented on GitHub (Oct 17, 2026): +1 I also have the same issue.
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271360680 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
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
Niko1221/Strata#1174
No description provided.