Skip to content

Aegis v0.2.9 (macOS): LLM gateway crashes on startup (import_meta.url undefined), plus external-endpoint/VLM bugs #215

Open

Description

@basaba07

Environment: SharpAI-Aegis v0.2.9 (Electron 40.2.1), macOS (Darwin 25.5.0). LLM and VLM both set to "OpenAI Compatible" pointing at a local Ollama (http://127.0.0.1:11434/v1, VLM qwen2.5vl:7b, LLM gemma4:e4b).

The LLM settings screen says "Connected", but the agent chat fails and clip analysis never works. I traced it through the app and found five separate problems (details and line numbers are from the unpacked app.asar).

1. LLM gateway crashes at startup, so port 5407 never opens (main blocker)

Startup log:

[TRACE] LLM Gateway failed to start: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received undefined
[LLM IPC] Gateway reload failed (may not be running): request to http://localhost:5407/api/config/reload failed

dist_electron_main/gateway.cjs ~line 2017: var import_meta = {}; followed by createRequire(import_meta.url). In the CJS bundle import_meta.url is undefined, so loading throws. Every agent/LLM call then fails with fetch failed.
Also: line ~2083 does esmRequire("../../../electron/config/cloud-providers.cjs"), and that file is not in the packaged build, so chat requests fail with Cannot find module once the first crash is patched.

2. LLM settings screen doesn't switch the active engine

Selecting "OpenAI Compatible" only writes ~/.aegis-ai/llm-config.json. ~/.aegis-ai/config/active-inference.json stayed on {"engineId": "llama-cpp", "port": 5411} and config/agent_config.json stayed on "llm": {"mode": "builtin"}, so the app still thinks the built-in server is the LLM.

3. VLM health checks ignore the external endpoint

  • video_analyze (and the background trigger inside video_search) probe http://localhost:<vlm_server port 5405>/health even when vlm.mode === "external". Nothing listens there, so the agent says "VLM unavailable" although the external VLM works.
  • The VLM monitor requests <externalEndpoint>/health, which Ollama answers with 404 (it has no /health), so the VLM can look offline. /v1/models would be a more portable check.

4. video_analyze / background analysis pass a null thumbnail

main.cjs ~30553: deepAnalyze(clipId, null, camera || "unknown", 0), and ~30396: bgAnalyze(clip.id, null, ...). analyzeClip then runs fs.existsSync(thumbnailPath) on null and returns Thumbnail not found: null, so these tool paths never reach the VLM. (The motion-event paths pass a real thumbnailPath and look fine.) After this the chat model tells the user the VLM is unavailable, which is misleading.

5. Thinking models return empty replies

With Gemma (thinking) models via Ollama, requests use max_tokens ~512, the model spends it on reasoning, and the reply has an empty content (reasoning is in a separate reasoning field):

[Agent] SSE stream ended with finish_reason=length — response was truncated (hit max_tokens limit)
[Agent] LLM response - has tool_calls: false, content length: 0

The user sees "I'm still warming up — try asking again in a moment." Sending reasoning_effort: "none" for local endpoints made replies reliable here (usable replies went from 2/4 to 5/5 in my test); raising the token limit or reading the reasoning field would also help.

Workarounds used

Ran a patched copy of the gateway outside the app (fix for #1 plus reasoning_effort: "none" for #5) and a tiny stub answering GET /health on 5405 (for #3).

Happy to test fixes.

Activity

  1. solderzzc commented on Oct 4, 2026

    @solderzzc
    Member

    Hi,

    Thanks for the detailed report.

    The gateway crash (createRequire / import.meta.url) is fixed in later builds; v0.2.9 is the only public build that still has it. Could you try 0.2.15?

    https://releases.sharpai.org/releases/SharpAI-Aegis-0.2.15-arm64.dmg

    Notes:

    • Apple Silicon (arm64) only. The build is notarized but not stapled, so the first launch needs an internet connection.
    • It is not on the auto-update feed yet. You will need to install it manually over 0.2.9.
    • What this should fix: the gateway failing to start in the packaged app.
    • What it will probably not fix: switching the LLM engine to Ollama from settings, the external VLM showing as offline, and video_analyze reporting "Thumbnail not found". We have reproduced the last two by reading the code and are tracking both. The Ollama engine-switch fix is not in 0.2.15.
    • Please avoid Uninstall -> Reinstall of the local engine on 0.2.15. It has a known issue there.
    • We could not reproduce the empty replies from thinking models yet. If you can share the model name and the Ollama version, that would help.

    Please tell us what you see on 0.2.15. We won't give a date for the next release yet.

  2. viri2005 commented on Oct 14, 2026

    @viri2005

    Hi,

    I have the same issue with version 0.2.9 under window11. local VLM is working but local LLM chat is broken. Local OpenAI Endpoint is working properly.

    Maybe I should also try 0.2.15. Do you have a release of 0.2.15 for windows ?

  3. solderzzc commented on Oct 14, 2026

    @solderzzc
    Member

    @viri2005 , thanks for your feedback, we are preparing 0.3.0, we wrote engines with Rust and many other changes are on going.
    Let me check how to replicate the issue on a Windows machine then prepare an 0.2.15 release.

  4. viri2005 commented on Oct 24, 2026

    @viri2005

    @solderzzc , thanks for your answer. Do you have some update on version 0.2.15 for windows 11?

  5. solderzzc commented on Oct 25, 2026

    @solderzzc
    Member

    Thanks for following up. The Windows build of version 0.2.15 is now uploaded. It is the code-signed installer (publisher: SharpAI LLC). So far we have only smoke-tested it on Windows 11 (the app launches and its bundled daemon starts). We have not verified every feature, so your feedback on Windows 11 is very helpful.

    We are now preparing 0.3.x. If you run into any problem with 0.2.15 on Windows 11, please tell us here and we will follow up quickly.

  6. solderzzc commented on Oct 25, 2026

    @solderzzc
    Member

    Download link for the Windows 0.2.15 installer (code-signed, publisher SharpAI LLC):
    https://releases.sharpai.org/releases/SharpAI-Aegis-Setup-0.2.15-win-x64.exe

  7. viri2005 commented on Oct 25, 2026

    @viri2005

    6. Download link for the Windows 0.2.15 installer (code-signed, publisher SharpAI LLC):
    https://releases.sharpai.org/releases/SharpAI-Aegis-Setup-0.2.15-win-x64.exe

    @solderzzc : thank you a lot for the link. I installed 0.2.15 under windows11.

    2 problems come up at start-up of 0.2.15 when LLM, VLM and camera have to be configured:
    1 - The issue with the LLM remains: Local LLM is connected, but the set-up in the "Hi I'm Aegis" start page is not done. Local OpenAI Endpoint is working properly, runs under llama-server.exe of llama.cpp. Local VLM is working and runs also under llama-server.exe of llama.cpp.

    2 - Now i lost the camera and it is not possible to connect it as it was under version 0.2.9. I get the following error with 0.2.15:
    "
    Error
    Failed to add camera: Error invoking remote method 'live-cameras:add': Error: Could not locate the bindings file. Tried: → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\build\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\build\Debug\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\build\Release\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\out\Debug\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\Debug\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\out\Release\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\Release\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\build\default\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\compiled\24.11.1\win32\x64\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\addon-build\release\install-root\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\addon-build\debug\install-root\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\addon-build\default\install-root\better_sqlite3.node → C:\SharpAI-Aegis\resources\app.asar\node_modules\better-sqlite3\lib\binding\node-v143-win32-x64\better_sqlite3.node
    "

    I hope you can use my feedback to solve the issues.

  8. solderzzc commented on Oct 25, 2026

    @solderzzc
    Member

    Hi @viri2005, thanks for the detailed report and the logs. Both problems you hit on 0.2.15 are addressed in 0.2.16, which is now published for Windows (code-signed, publisher SharpAI LLC):

    https://releases.sharpai.org/releases/SharpAI-Aegis-Setup-0.2.16-win-x64.exe

    1. Camera add ("Could not locate the bindings file"): the 0.2.16 build now checks that the packaged app contains a Windows better-sqlite3 binding before anything is uploaded. In our isolated test of the packaged app, adding a camera succeeds.

    2. Start page LLM setup not complete with a local llama-server endpoint: a local OpenAI-compatible endpoint that needs no API key is now checked for a model list, and the setup check counts it as configured when it answers. In our isolated test the start page showed 1 of 3 complete while the endpoint was running.

    We have not run this on your machine, so your feedback is what matters. Could you install 0.2.16 over 0.2.15 and tell us:

    • whether the start page reports LLM setup as complete with your llama-server, and
    • whether adding the camera works.

    If something is still wrong, please paste the exact error text here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions