This Friday: Hear from Sanity + Vercel experts on AI and better personalization in e-commerce

Sanity CLI dataset and CORS commands not found in Studio v3

13 repliesLast updated: Nov 29, 2025

Hello everyone, I’m wondering how to interact with the CLI and sanity studio v3. It seems that some commands no longer exists (like dataset and CORS)?
Here is the error message I get when I run
sanity help dataset
for example:
Error: Command "dataset" is not available outside of a Sanity project context.

Run the command again within a Sanity project directory, where "@sanity/core" is installed as a dependency.
AI Update

Good 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.

The Context Issue

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:

cd /path/to/your-sanity-project
sanity dataset list
sanity cors list

Available Dataset & CORS Commands

Once you're in the correct directory, these commands should work:

Dataset commands:

CORS commands:

CLI Configuration

Make 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.

Show original thread
13 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

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.

Related contributions