[GH-ISSUE #3851] [GUI] the App Host's source-checkout mode cannot start an engine: it passes an empty STRATA_API_KEY, which serve/server.py refuses #1639

Closed
opened 2026-11-04 01:52:50 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @demetree on GitHub (Oct 23, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3851

Area

[GUI] (the desktop app; here its source-checkout mode)

Desktop app, Terminal or source?

Source (START-HERE.bat, setup.sh or a build) - npm run dev in apps/host

What happened

From a source checkout, the App Host cannot start an engine. Loading any model ends with
Engine stopped (exit 2), and /api/native/logs carries:

[strata] an API key was given but it is empty: set a key, or leave it out

The cause is in apps/host/server/native-control.mjs, in the loadEngine branch that runs when the host is not
packaged (a source checkout). It starts the server like this:

proc=spawnProcess(py,[join(repo(),'serve/server.py'),'--engine','strata','--config',configPath,
  '--port',String(cfg.port),'--host','127.0.0.1'],
  {..., env:{...process.env, PYTHONUNBUFFERED:'1', PYTHONUTF8:'1', PYTHONIOENCODING:'utf-8', STRATA_API_KEY:''}});

STRATA_API_KEY is set to the empty string. serve/server.py reads it as the default for --api-key
(line 7967: default=os.environ.get("STRATA_API_KEY", "")) and refuses a key that is present but empty (line 8073,
the #213 rule: a value that is only whitespace "never means no key"). It exits 2 before it reads the config, so the
model never loads.

The intent is right - the instance's key is in the run config the host just wrote (cfg.api_key), and an inherited
STRATA_API_KEY from the user's environment must not override it - but an empty string is not the way to say that.
strata_control's packaged path does it properly: control-runtime.mjs line 80 deletes the variable
(for (const key of [... 'STRATA_API_KEY']) delete next[key];). So the installed app is unaffected and only the
source path is affected.

Smallest steps or command that reproduce it

  1. npm install in apps/host, then npm run dev (host on :8791, UI on :5199).
  2. In the UI, connect a checkout whose run configs name a real engine, and press Load on a model.
  3. The load job ends Engine stopped (exit 2); /api/native/logs has the line above.

Reproduction status

Reproduced locally (I ran it and saw it fail, then fixed it and saw the same load succeed)

Strata version

Strata 0.2.3 ? Control 0.1.48.1 ? engine 0.1.48 (the source checkout; the host reports itself as un-packaged)

Graphics card, memory and system

Intel Arc Pro B70 32 GB ? 64 GB RAM ? Windows 11 25H2 ? Node 24.20.0

Model, size and settings

Qwen3.8-Flash-Next Coder IQ1_M ? 256K context (run config strata-coder-iq1_m-agentic.json, started through
serve/server.py)

Logs

[strata-mcp] ready (Strata folder E:\Strata)
[strata] an API key was given but it is empty: set a key, or leave it out

The fix

Delete the variable from the child environment instead of setting it to an empty string, which is what Control
already does:

const serverEnv={...process.env,PYTHONUNBUFFERED:'1',PYTHONUTF8:'1',PYTHONIOENCODING:'utf-8'};
delete serverEnv.STRATA_API_KEY;          // the config carries this instance's key; present-but-empty is refused
proc=spawnProcess(py,[...],{...,env:serverEnv});

With that one line the same Load started the model through the app: instance ready on 127.0.0.1:18500, all
12,288 experts filled (23.42 GiB VRAM), and the app's own benchmark returned 200 tokens at 60.2 tok/s.

I have this locally as a one-line change on a Windows source checkout and can open it as its own PR if you want it
(two different problems, so not folded into another change).

Originally created by @demetree on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3851 ### Area [GUI] (the desktop app; here its source-checkout mode) ### Desktop app, Terminal or source? Source (START-HERE.bat, setup.sh or a build) - `npm run dev` in `apps/host` ### What happened From a source checkout, the App Host cannot start an engine. Loading any model ends with `Engine stopped (exit 2)`, and `/api/native/logs` carries: ``` [strata] an API key was given but it is empty: set a key, or leave it out ``` The cause is in `apps/host/server/native-control.mjs`, in the `loadEngine` branch that runs when the host is not packaged (a source checkout). It starts the server like this: ```js proc=spawnProcess(py,[join(repo(),'serve/server.py'),'--engine','strata','--config',configPath, '--port',String(cfg.port),'--host','127.0.0.1'], {..., env:{...process.env, PYTHONUNBUFFERED:'1', PYTHONUTF8:'1', PYTHONIOENCODING:'utf-8', STRATA_API_KEY:''}}); ``` `STRATA_API_KEY` is set to the **empty string**. `serve/server.py` reads it as the default for `--api-key` (line 7967: `default=os.environ.get("STRATA_API_KEY", "")`) and refuses a key that is present but empty (line 8073, the #213 rule: a value that is only whitespace "never means no key"). It exits 2 before it reads the config, so the model never loads. The intent is right - the instance's key is in the run config the host just wrote (`cfg.api_key`), and an inherited `STRATA_API_KEY` from the user's environment must not override it - but an empty string is not the way to say that. `strata_control`'s packaged path does it properly: `control-runtime.mjs` line 80 **deletes** the variable (`for (const key of [... 'STRATA_API_KEY']) delete next[key];`). So the installed app is unaffected and only the source path is affected. ### Smallest steps or command that reproduce it 1. `npm install` in `apps/host`, then `npm run dev` (host on :8791, UI on :5199). 2. In the UI, connect a checkout whose run configs name a real engine, and press Load on a model. 3. The load job ends `Engine stopped (exit 2)`; `/api/native/logs` has the line above. ### Reproduction status Reproduced locally (I ran it and saw it fail, then fixed it and saw the same load succeed) ### Strata version Strata 0.2.3 ? Control 0.1.48.1 ? engine 0.1.48 (the source checkout; the host reports itself as un-packaged) ### Graphics card, memory and system Intel Arc Pro B70 32 GB ? 64 GB RAM ? Windows 11 25H2 ? Node 24.20.0 ### Model, size and settings Qwen3.8-Flash-Next Coder IQ1_M ? 256K context (run config `strata-coder-iq1_m-agentic.json`, started through `serve/server.py`) ### Logs ``` [strata-mcp] ready (Strata folder E:\Strata) [strata] an API key was given but it is empty: set a key, or leave it out ``` --- ### The fix Delete the variable from the child environment instead of setting it to an empty string, which is what Control already does: ```js const serverEnv={...process.env,PYTHONUNBUFFERED:'1',PYTHONUTF8:'1',PYTHONIOENCODING:'utf-8'}; delete serverEnv.STRATA_API_KEY; // the config carries this instance's key; present-but-empty is refused proc=spawnProcess(py,[...],{...,env:serverEnv}); ``` With that one line the same Load started the model through the app: instance `ready` on `127.0.0.1:18500`, all 12,288 experts filled (23.42 GiB VRAM), and the app's own benchmark returned 200 tokens at 60.2 tok/s. I have this locally as a one-line change on a Windows source checkout and can open it as its own PR if you want it (two different problems, so not folded into another change).
Author
Owner

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

Thank you, found and confirmed in the code: the source-checkout start passes an empty key and the server refuses it. Fixed in 0.2.7 by leaving the variable out.

Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7

<!-- gh-comment-id:6445834727 --> @Niko1221 commented on GitHub (Oct 27, 2026): Thank you, found and confirmed in the code: the source-checkout start passes an empty key and the server refuses it. Fixed in 0.2.7 by leaving the variable out. Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7
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#1639
No description provided.