<@ULVA73B9P> I am trying to change from a prod to ...
# marvin-ai
c
@Marvin I am trying to change from a prod to a dev workspace, but when using “prefect cloud workspace set —workspace {dev workspace}” I get a message saying I’ve changed workspaces but when I check with ls I remain on prod. How can I guarantee I change workspaces on the cli?
n
i think i remember this being a bug from a while ago what does
prefect version
say?
also somehow I think the slack app mention didn't happen here? odd
m
thought for 239.4 seconds
c
My version is 3.1.5, was that one bugged?
I will say even after updating my version to 3.4.18 I’m still seeing the same issue
m
It sounds like the workspace change isn’t being reflected in your active environment. A few things can cause that in Prefect 3.x (profiles, env var overrides, or just checking the wrong thing). Here’s a reliable way to switch and verify from the CLI. First, a couple of quick checks - Make sure you’re on Prefect 3.x:
Copy code
prefect version
- Confirm which profile is active and what it’s configured to use:
Copy code
prefect profile ls
  prefect profile inspect
- Check for environment variable overrides that will “pin” you to a workspace: - macOS/Linux:
Copy code
env | grep PREFECT
If you see
PREFECT_API_URL
,
PREFECT_API_KEY
, or
PREFECT_PROFILE
set, they override your profile. Unset them:
Copy code
unset PREFECT_API_URL PREFECT_API_KEY PREFECT_PROFILE
- Windows (PowerShell):
Copy code
gci env:PREFECT*
Unset with:
Copy code
Remove-Item Env:PREFECT_API_URL, Env:PREFECT_API_KEY, Env:PREFECT_PROFILE
How to set the workspace correctly - Use the full handle and regular double hyphens. The format is
<account_handle>/<workspace_handle>
(e.g.,
my-org/dev
):
Copy code
prefect cloud workspace set --workspace my-org/dev
Tip: Avoid curly quotes or em-dashes that sometimes appear from copy/paste. How to verify you actually switched - Open the current workspace to visually confirm:
Copy code
prefect cloud open
- Inspect effective config and sources:
Copy code
prefect config view --hide-defaults --show-sources
Look for
PREFECT_API_URL
whose value should include your dev workspace ID (the URL typically contains
/accounts/<account_id>/workspaces/<workspace_id>
). The “source” should be “profile” unless you’ve set env vars. - Optionally, inspect something that differs by workspace, e.g.:
Copy code
prefect work-pool ls
The pools should match what exists in your dev workspace. Common gotchas -
prefect cloud workspace ls
lists available workspaces but does not necessarily indicate which one is currently active. Use
prefect cloud open
or
prefect config view
to verify the active one. - If you have multiple profiles,
prefect cloud workspace set
only updates the currently active profile. Make sure you’re operating in the profile you think you are:
Copy code
prefect profile ls
  prefect profile use <your-profile>
- Shell or CI environment variables (e.g., from a
.env
file or CI job) can override your profile. Unset or update them if present. If all else fails, re-authenticate cleanly - Log out then log back into the target workspace in one step:
Copy code
prefect cloud logout
  prefect cloud login -k <YOUR_API_KEY> -w my-org/dev
Then verify with
prefect cloud open
and
prefect config view
. Docs for reference: - Workspaces in Prefect Cloud - Connect to Prefect Cloud - Settings and Profiles If you can share: - Your Prefect version (
prefect version
) - The exact command you ran (including the handle you used) - Output from
prefect profile inspect
and
prefect config view --hide-defaults --show-sources
…I can pinpoint why it’s sticking to prod in your environment.
n
hm yea id check
prefect config view
for something strange, i cant reproduce that behavior on latest prefect
Copy code
» prefect cloud workspace set -w prefect-technologies/marvin-bot
Successfully set workspace to 'prefect-technologies/marvin-bot' in profile 'pond'.

» prefect cloud workspace ls | rg bot
│   prefect-sandbox/roast-bot                       │
│ * prefect-technologies/marvin-bot                 │

» prefect cloud workspace set -w prefect-sandbox/inconspicuous-pond
Successfully set workspace to 'prefect-sandbox/inconspicuous-pond' in profile 'pond'.

» prefect cloud workspace ls | rg pond
│ * prefect-sandbox/inconspicuous-pond              │