
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGood news - those commands still exist! The error message is actually telling you exactly what's happening: you need to run these commands from within a Sanity project directory, not just anywhere on your system.
In Sanity CLI v3, many commands like dataset and cors require you to be inside a Sanity project folder (where @sanity/core is installed as a dependency). This is different from some global CLI operations that can run anywhere.
Here's how to fix this:
sanity.config.ts or sanity.config.js file lives)cd /path/to/your-sanity-project
sanity dataset list
sanity cors listOnce you're in the correct directory, these commands should work:
Dataset commands:
sanity dataset list - List all datasets in your projectsanity dataset create <name> - Create a new datasetsanity dataset export - Export dataset contentsanity dataset import - Import data into a datasetCORS commands:
sanity cors list - List CORS originssanity cors add <origin> - Add a CORS originsanity cors delete <id> - Remove a CORS originMake sure your project has a CLI configuration file (sanity.cli.js or sanity.cli.ts) in the project root with your project ID:
import { defineCliConfig } from "sanity/cli";
export default defineCliConfig({
api: {
projectId: 'your-project-id',
dataset: 'production'
}
});You can find more details in the official CLI documentation.
If you're trying to manage multiple projects, you'll need to cd into each project's directory before running these context-dependent commands, or use the --project flag where supported to specify which project you're working with.
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