Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

strata_bench.py: NameError: name 'port' is not defined when it starts the server itself (0.1.45, since #2330)

Open Beginner friendly
#2,908 1 comment 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
96/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start with the server-start branch around lines 987-991 in tools/strata_bench.py, then reproduce with tools\strata_bench.py --config strata-iq3_s.json --long while no server is running. Confirm the config-defined or argument-supplied port is available before constructing the base URL and starting the server; the command should pass the startup path instead of raising NameError.

Written by the indexing model from the issue text.

Description

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.

Dominant language
C++
Stars
11.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Niko1221/Strata

All issues in Niko1221/Strata

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.