Unexpected error retrieving remote project status: {"message":"Unauthorized"}
๐ Supabase CLI Bug Report - Authorization Error
Date: September 9, 2025
CLI Version: Tested on v2.39.2 and v2.40.7
OS: Windows 11
Project ID: cpxx
Sent crash report: e70bd6b3b7544a4881e67f76fd541c89
๐จ Issue Summary
Problem: CLI command supabase link --project-ref cpxx consistently returns {"message":"Unauthorized"} despite valid access token and successful API access.
Expected: Successful project linking
Actual: Authorization failure on CLI, while direct API calls work perfectly
๐ Detailed Description
Symptoms
- โ
supabase link --project-ref cpxxโ "Unauthorized" - โ
supabase db pull --linkedโ "Unauthorized" - โ
supabase login --token xxxโ Success - โ
supabase projects listโ Shows both projects - โ Direct API calls work perfectly
Environment
- OS: Windows 11 x64
- CLI Installation: Scoop package manager
- Versions Tested: 2.39.2 โ 2.40.7 (both fail)
- Token Type: Personal Access Token (sbp_...)
- Organization: osxx
- Region: us-east-2
๐งช Reproduction Steps
Setup
# Install/Update CLI
scoop install supabase
scoop update supabase # v2.40.7
# Login (SUCCESS)
supabase login --token sbp_57xx
# Output: "You are now logged in. Happy coding!"
# List projects (SUCCESS)
supabase projects list
# Shows project correctly | cpxx
Failing Command
# This consistently fails
supabase link --project-ref cpxx
# Error: Unexpected error retrieving remote project status: {"message":"Unauthorized"}
# Debug output shows:
supabase link --project-ref cpxx --debug
# Supabase CLI 2.40.7
# Loading project ref from flag: cpxx
# Using access token from env var...
# HTTP GET: https://api.supabase.com/v1/projects/cpxx
# Unexpected error retrieving remote project status: {"message":"Unauthorized"}
Working API Calls
# Direct API access works perfectly
curl -H "Authorization: Bearer sbp_57xx" \
https://api.supabase.com/v1/projects/cpxx
# Returns valid project data
curl -H "Authorization: Bearer sbp_57xx" \
https://api.supabase.com/v1/projects
# Returns array with both projects including cpxx
๐ง Troubleshooting Attempted
What We Tried
- โ Updated CLI: v2.39.2 โ v2.40.7 (same error)
- โ Re-login multiple times: Always succeeds
- โ
Fresh project init:
supabase initโ clean start - โ Verified token permissions: Works with direct API
- โ
Different flag combinations:
--password,--debug - โ Network connectivity: API calls successful
What Works
- โ
supabase login --token xxx - โ
supabase projects list - โ
supabase status(local) - โ
supabase start(local) - โ Direct curl API calls
What Fails
- โ
supabase link --project-ref xxx - โ
supabase db pull --linked - โ Any command requiring project linking
Same issue.
Hi, I'm just doing a clean up of issues, Did you manage to get this one working in the end?
Just got this issue recently what worked for me was;
unset SUPABASE_ACCESS_TOKEN
Then check if it's been removed with
echo $SUPABASE_ACCESS_TOKEN
Then just log back in with supabase login which prompted me to re-authenticated with the web browser this time which solved the issue so seem'd like a stale token problem.
Hi! Thanks for opening this issue.
We're closing this because it has not had any activity for 45 days, and we try to keep the Supabase CLI issue tracker focused on reports that are still current.
If this still reproduces on the latest Supabase CLI, please comment with /reopen on its own line and include your CLI version, updated reproduction steps, and any recent error output. We appreciate the signal and are happy to take another look.