
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeHey! This is a classic authentication issue with the Sanity CLI. Based on the official CLI errors documentation, the "Unauthorized - Session not found" error can happen for a few different reasons when running commands like sanity graphql deploy or sanity graphql list.
The most common solution is to log out and log back in with the CLI:
npx sanity logout
npx sanity login(Or use pnpm dlx, yarn dlx, or bunx depending on your package manager)
According to the Sanity docs, this error can occur because:
SANITY_AUTH_TOKEN environment variable set, it might be invalidThe Sanity CLI stores your authentication session locally (typically in ~/.config/sanity on Mac/Linux). When you've been away for a while, this session can expire or become invalid.
package.json and sanity.config.js/ts files are)projectId and dataset configured in sanity.cli.js or sanity.cli.tsThe logout/login cycle should refresh your session and get you back up and running. Welcome back! 🎉
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store