[GH-ISSUE #6268] [Issue]: Custom OAI-compatible connection to LM Studio returns 502 on Fetch Models #3500

Closed
opened 2026-10-21 06:03:40 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @bisqweet on GitHub (Sep 17, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6268

Originally assigned to: @SpicyMarinara on GitHub.

Environment

  • Marinara Engine version: v2.4.6
  • OS: Windows 10 (or 11 — update as needed)
  • Install method: manual / launcher (update as needed)
  • Browser: Brave (Chromium-based)
  • Backend: LM Studio 0.4.24 with L3-8B-Stheno-v3.2 loaded

Problem

Adding a Custom (OAI-Compatible) connection pointing at LM Studio's local server (http://localhost:1234/v1) fails on "Fetch Models from API" with the error:

Failed to fetch models: fetch failed

Browser DevTools Console shows:

Failed to load resource: the server responded with a status of 502 (Bad Gateway)
http://localhost:7860/api/connection/1/models

What works

LM Studio's OpenAI-compatible API is confirmed working:

  • http://localhost:1234/v1/models returns the correct JSON with the model list from both the browser address bar and curl.
  • LM Studio server logs show it responding correctly.

What does NOT work

  • Marinara's "Fetch Models from API" button always returns 502.
  • LM Studio's server logs show zero incoming requests from Marinara — so the request is dying inside Marinara's backend, not LM Studio.
  • The same behavior occurs whether the Base URL uses localhost:1234/v1 or 127.0.0.1:1234/v1.

Marinara connection settings used

  • Provider: Custom (OAI-Compatible)
  • API Key: (empty)
  • Base URL: http://localhost:1234/v1
  • Treat as local/custom endpoint: ON
  • Model: (empty — trying to fetch)

LM Studio settings

  • Server running on port 1234
  • Require Authentication: OFF
  • Enable CORS: ON
  • Serve on Local Network: OFF (everything is local, same machine)

Access details

  • Accessing Marinara at: http://localhost:7860/
  • Accessing LM Studio at: http://localhost:1234/
  • Same machine, loopback only.

Privileged API actions (e.g. Restart Server) also fail with ADMIN_SECRET is required for privileged APIs, even though:

  • ADMIN_SECRET is set in .env
  • The matching value is saved in Settings → Advanced → Admin Access
  • MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK=false
  • TRUSTED_PRIVATE_NETWORKS=127.0.0.1/32,::1/128
  • DevTools confirms the X-Admin-Secret header is sent on the failing request
  • The app is accessed via http://localhost:7860/

Both the 502 and the ADMIN_SECRET failures might share a root cause in the backend's privileged-gate / proxy middleware. Flagging in case it's the same bug.

Request

Any guidance on:

  1. Whether there's an additional setting required for Custom (OAI-Compatible) connections to local servers on Windows.
  2. Whether the 502 is a known regression in v2.4.6.
Originally created by @bisqweet on GitHub (Sep 17, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6268 Originally assigned to: @SpicyMarinara on GitHub. ### Environment - Marinara Engine version: v2.4.6 - OS: Windows 10 (or 11 — update as needed) - Install method: manual / launcher (update as needed) - Browser: Brave (Chromium-based) - Backend: LM Studio 0.4.24 with L3-8B-Stheno-v3.2 loaded ### Problem Adding a Custom (OAI-Compatible) connection pointing at LM Studio's local server (`http://localhost:1234/v1`) fails on "Fetch Models from API" with the error: Failed to fetch models: fetch failed Browser DevTools Console shows: Failed to load resource: the server responded with a status of 502 (Bad Gateway) http://localhost:7860/api/connection/1/models ### What works LM Studio's OpenAI-compatible API is confirmed working: - `http://localhost:1234/v1/models` returns the correct JSON with the model list from both the browser address bar and `curl`. - LM Studio server logs show it responding correctly. ### What does NOT work - Marinara's "Fetch Models from API" button always returns 502. - LM Studio's server logs show **zero incoming requests from Marinara** — so the request is dying inside Marinara's backend, not LM Studio. - The same behavior occurs whether the Base URL uses `localhost:1234/v1` or `127.0.0.1:1234/v1`. ### Marinara connection settings used - Provider: Custom (OAI-Compatible) - API Key: (empty) - Base URL: `http://localhost:1234/v1` - Treat as local/custom endpoint: ON - Model: (empty — trying to fetch) ### LM Studio settings - Server running on port 1234 - Require Authentication: OFF - Enable CORS: ON - Serve on Local Network: OFF (everything is local, same machine) ### Access details - Accessing Marinara at: `http://localhost:7860/` - Accessing LM Studio at: `http://localhost:1234/` - Same machine, loopback only. ### Admin secret context (possibly related) Privileged API actions (e.g. Restart Server) also fail with `ADMIN_SECRET is required for privileged APIs`, even though: - `ADMIN_SECRET` is set in `.env` - The matching value is saved in Settings → Advanced → Admin Access - `MARINARA_REQUIRE_ADMIN_SECRET_ON_LOOPBACK=false` - `TRUSTED_PRIVATE_NETWORKS=127.0.0.1/32,::1/128` - DevTools confirms the `X-Admin-Secret` header is sent on the failing request - The app is accessed via `http://localhost:7860/` Both the 502 and the ADMIN_SECRET failures might share a root cause in the backend's privileged-gate / proxy middleware. Flagging in case it's the same bug. ### Request Any guidance on: 1. Whether there's an additional setting required for Custom (OAI-Compatible) connections to local servers on Windows. 2. Whether the 502 is a known regression in v2.4.6.
bsakaguchi 2026-10-21 06:03:40 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Sep 17, 2026):

Owner: @SpicyMarinara. Codex is addressing this in draft PR #6282 as part of the requested issue sweep. Focused implementation and regression/browser verification are in progress.

<!-- gh-comment-id:5710997251 --> @SpicyMarinara commented on GitHub (Sep 17, 2026): Owner: @SpicyMarinara. Codex is addressing this in draft PR #6282 as part of the requested issue sweep. Focused implementation and regression/browser verification are in progress.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 17, 2026):

PR #6282 adds useful diagnostics without weakening outbound URL validation: the UI includes the socket/DNS error code (for example ECONNREFUSED), and the server log retains the underlying cause. Regression coverage exercises keyless custom model discovery through both localhost and 127.0.0.1, plus a stopped local provider.

Both working loopback cases pass on the current code. This does not reproduce the reported Windows/LM Studio failure, so I am leaving this issue open. The ADMIN_SECRET rejection is a separate configuration/authentication path; there is no evidence connecting it to the model-fetch failure.

The next useful evidence is the network code and matching server log from the affected Windows installation after #6282 lands, plus whether that Marinara process runs natively, under WSL, or in a container. The browser and curl checks alone do not establish reachability from the actual server process.

<!-- gh-comment-id:5711632101 --> @SpicyMarinara commented on GitHub (Sep 17, 2026): PR #6282 adds useful diagnostics without weakening outbound URL validation: the UI includes the socket/DNS error code (for example ECONNREFUSED), and the server log retains the underlying cause. Regression coverage exercises keyless custom model discovery through both localhost and 127.0.0.1, plus a stopped local provider. Both working loopback cases pass on the current code. This does not reproduce the reported Windows/LM Studio failure, so I am leaving this issue open. The ADMIN_SECRET rejection is a separate configuration/authentication path; there is no evidence connecting it to the model-fetch failure. The next useful evidence is the network code and matching server log from the affected Windows installation after #6282 lands, plus whether that Marinara process runs natively, under WSL, or in a container. The browser and curl checks alone do not establish reachability from the actual server process.
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
Pasta-Devs/Marinara-Engine#3500
No description provided.