[GH-ISSUE #5528] [bug] Environment variables fully overridden when changing Environment during pending request #2133

Closed
opened 2026-03-16 23:17:48 +03:00 by kerem · 3 comments
Owner

Originally created by @jakfalter on GitHub (Oct 29, 2025).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5528

Originally assigned to: @nivedin on GitHub.

Is there an existing issue for this?

N/A

Current behavior

Switching Environments during an active request will completely overwrite all (both current and initial) environment variable values with the values from the Environment that has been selected before. This is a critical data loss issue - user data in environments can be accidentally corrupted by switching environments at the wrong time.

Expected Behavior

Environment variable values should never be updated during request execution.

Steps to reproduce

  1. Create two Environments A and B with the same variable test-variable and set it to ABC in Environment A and DEF in Environment B.
Image Image

Here is how it looks in the Database

Image
  1. Select Environment B.
  2. Now send some kind of request that uses the variable from the environment and does not immediately respond. To test I have sent a simple GET request to koreanbuilds.net as it gave me 5 seconds during which I switched to Environment A.
Image

Now check the contents of Environment A, test-variable is now overwritten with DEF

Image

We can confirm the same by looking into the database

Image

Hoppscotch Version

Server: Self hosted 2025.6.1
Client: MacOS Desktop 2025.6.1

Interceptor

N/A

Browsers Affected

N/A

Operating System

MacOS

Additional Information

N/A

Originally created by @jakfalter on GitHub (Oct 29, 2025). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5528 Originally assigned to: @nivedin on GitHub. # Is there an existing issue for this? N/A # Current behavior Switching Environments during an active request will completely overwrite all (both current and initial) environment variable values with the values from the Environment that has been selected before. This is a critical data loss issue - user data in environments can be accidentally corrupted by switching environments at the wrong time. # Expected Behavior Environment variable values should never be updated during request execution. # Steps to reproduce 1. Create two Environments A and B with the same variable `test-variable` and set it to `ABC` in Environment A and `DEF` in Environment B. <img width="833" height="352" alt="Image" src="https://github.com/user-attachments/assets/9fddddec-0499-4d83-9976-44df0a6feaf1" /> <img width="759" height="296" alt="Image" src="https://github.com/user-attachments/assets/2d1a755e-8436-4535-96f7-ded2d881b1b6" /> Here is how it looks in the Database <img width="1297" height="58" alt="Image" src="https://github.com/user-attachments/assets/fe3d44b8-2617-47a5-b21a-025a9c97a150" /> 2. Select Environment B. 3. Now send some kind of request that uses the variable from the environment and does not immediately respond. To test I have sent a simple GET request to koreanbuilds.net as it gave me 5 seconds during which I switched to Environment A. <img width="1370" height="831" alt="Image" src="https://github.com/user-attachments/assets/6fedf466-57ec-4cf8-a264-83dfea5ba7d5" /> Now check the contents of Environment A, `test-variable` is now overwritten with `DEF` <img width="757" height="293" alt="Image" src="https://github.com/user-attachments/assets/2a754c47-3246-48c1-8b3a-cbab416c68a9" /> We can confirm the same by looking into the database <img width="1458" height="73" alt="Image" src="https://github.com/user-attachments/assets/d9cb564c-b96d-47b3-92c8-affdbc51e9fd" /> # Hoppscotch Version Server: Self hosted 2025.6.1 Client: MacOS Desktop 2025.6.1 # Interceptor N/A # Browsers Affected N/A # Operating System MacOS # Additional Information N/A
kerem 2026-03-16 23:17:48 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@kbamponsem commented on GitHub (Oct 30, 2025):

I could also add on this issue that the pw.env.set isn't working anymore.

My particular case:
I call it in a Post-request script to set some envs after my API call and they are not set.

Thanks.

<!-- gh-comment-id:3466155758 --> @kbamponsem commented on GitHub (Oct 30, 2025): I could also add on this issue that the `pw.env.set` isn't working anymore. My particular case: I call it in a Post-request script to set some envs after my API call and they are not set. Thanks.
Author
Owner

@jamesgeorge007 commented on GitHub (Nov 3, 2025):

I could also add on this issue that the pw.env.set isn't working anymore.

My particular case: I call it in a Post-request script to set some envs after my API call and they are not set.

Thanks.

Hi @kbamponsem, could you confirm if this is reproducible in the latest version?

<!-- gh-comment-id:3479193476 --> @jamesgeorge007 commented on GitHub (Nov 3, 2025): > I could also add on this issue that the `pw.env.set` isn't working anymore. > > My particular case: I call it in a Post-request script to set some envs after my API call and they are not set. > > Thanks. Hi @kbamponsem, could you confirm if this is reproducible in the latest version?
Author
Owner

@jamesgeorge007 commented on GitHub (Nov 13, 2025):

Closing since this is fixed in the latest release.

<!-- gh-comment-id:3528103092 --> @jamesgeorge007 commented on GitHub (Nov 13, 2025): Closing since this is fixed in the [latest release](https://github.com/hoppscotch/hoppscotch/releases/tag/2025.10.1).
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
starred/hoppscotch#2133
No description provided.