[GH-ISSUE #4778] [BUG]: Codespaces backend port 3001 not auto-forwarded #3008

Closed
opened 2026-02-22 18:32:14 -05:00 by yindo · 0 comments
Owner

Originally created by @lohas1107 on GitHub (Dec 13, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4778

How are you running AnythingLLM?

Local development (GitHub Codespaces / Dev Container)

What happened?

When developing in GitHub Codespaces, the backend dev server on port 3001 is not reliably auto-forwarded / discoverable.

This is confusing because the devcontainer configuration already contains portsAttributes for 3001, but in practice the port may not get forwarded, which prevents the frontend from reaching the backend API using the expected Codespaces forwarded domain.

Expected

  • Starting the backend in Codespaces causes port 3001 to appear in the Ports view and be forwarded consistently.
  • The frontend can reach ...-3001.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/api without manual port forwarding.

Actual

  • Port 3001 sometimes does not auto-forward (or doesn’t show up as forwarded), requiring manual intervention.
  • gh codespace ports can remain empty until the port is manually forwarded, which also breaks any automation that waits on gh codespace ports | grep 3001.

Are there known steps to reproduce?

  1. Create a new Codespace for this repo.
  2. Start the backend (e.g. run the VS Code task “Server: run” or cd server && yarn dev).
  3. Check the Ports tab and/or run gh codespace ports -c $CODESPACE_NAME.

Observed: port 3001 is not always forwarded automatically.

Notes on likely root cause (IPv6 / localhost behavior)

There are two related behaviors that appear to contribute to how confusing this is:

  1. portsAttributes doesn’t force forwarding.

portsAttributes controls labels and what to do after a port is forwarded, but does not guarantee that forwarding will happen. In Codespaces, if the port is not auto-forwarded for any reason, it won’t show up as forwarded.

  1. VS Code Remote port forwarding has known IPv6 edge cases.

The VS Code Remote extensions have a long-standing issue where port forwarding can be unreliable when a service is bound to the IPv6 loopback address (::1) or when localhost resolves to IPv6 first. This is documented in microsoft/vscode-remote-release#7029.

Even when an application “works locally”, the tunnel may end up targeting an IPv6 loopback address which can break connectivity from the forwarded address.

Reference:

Proposed fix

Explicitly declare forwarded ports in the devcontainer configuration:

"forwardPorts": [3001, 3000]
Originally created by @lohas1107 on GitHub (Dec 13, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4778 ### How are you running AnythingLLM? Local development (GitHub Codespaces / Dev Container) ### What happened? When developing in **GitHub Codespaces**, the backend dev server on port **3001** is not reliably auto-forwarded / discoverable. This is confusing because the devcontainer configuration already contains `portsAttributes` for `3001`, but in practice the port may not get forwarded, which prevents the frontend from reaching the backend API using the expected Codespaces forwarded domain. **Expected** - Starting the backend in Codespaces causes port **3001** to appear in the Ports view and be forwarded consistently. - The frontend can reach `...-3001.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}/api` without manual port forwarding. **Actual** - Port **3001** sometimes does not auto-forward (or doesn’t show up as forwarded), requiring manual intervention. - `gh codespace ports` can remain empty until the port is manually forwarded, which also breaks any automation that waits on `gh codespace ports | grep 3001`. ### Are there known steps to reproduce? 1. Create a new Codespace for this repo. 2. Start the backend (e.g. run the VS Code task “Server: run” or `cd server && yarn dev`). 3. Check the Ports tab and/or run `gh codespace ports -c $CODESPACE_NAME`. **Observed**: port 3001 is not always forwarded automatically. ### Notes on likely root cause (IPv6 / localhost behavior) There are two related behaviors that appear to contribute to how confusing this is: 1) **`portsAttributes` doesn’t force forwarding.** `portsAttributes` controls labels and what to do *after* a port is forwarded, but does not guarantee that forwarding will happen. In Codespaces, if the port is not auto-forwarded for any reason, it won’t show up as forwarded. 2) **VS Code Remote port forwarding has known IPv6 edge cases.** The VS Code Remote extensions have a long-standing issue where port forwarding can be unreliable when a service is bound to the IPv6 loopback address (`::1`) or when `localhost` resolves to IPv6 first. This is documented in microsoft/vscode-remote-release#7029. Even when an application “works locally”, the tunnel may end up targeting an IPv6 loopback address which can break connectivity from the forwarded address. Reference: - https://github.com/microsoft/vscode-remote-release/issues/7029 ### Proposed fix Explicitly declare forwarded ports in the devcontainer configuration: ```jsonc "forwardPorts": [3001, 3000]
yindo closed this issue 2026-02-22 18:32:14 -05:00
yindo changed title from [BUG]: Codespaces backend port 3001 not auto-forwarded to [GH-ISSUE #4778] [BUG]: Codespaces backend port 3001 not auto-forwarded 2026-06-05 14:49:48 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3008