Failed to Load Resource: the Server Responded with a Status of 404 (Not Found)

1 replies
Last updated: Jul 1, 2022
I’m looking for help with the sanity studio cli. I’m running a new project deployment under getting started (have tried other boilerplates) and keep getting
Cannot GET / 
on the localhost:3333 that gets compiled.


Failed to load resource: the server responded with a status of 404 (Not Found)
is the error code in the console.
AI Update

This is a common issue that usually happens when something else is already running on port 3333, or there's a configuration issue with your Studio setup. Here's how to troubleshoot and fix it:

Quick Solutions

1. Check if port 3333 is already in use

The most common cause is another process using port 3333. To fix this:

  • On macOS/Linux: Run lsof -ti :3333 | xargs kill -9 to kill any process using that port
  • On Windows: Use Task Manager to find and end the process using port 3333

2. Run Studio on a different port

You can specify a different port when starting the dev server:

npx sanity dev --port 3334

Or if you're using npm scripts:

npm run dev -- --port 3334

3. Configure a permanent custom port

If you want to always use a different port, edit your sanity.cli.ts (or create one if it doesn't exist):

import {defineCliConfig} from 'sanity/cli'

export default defineCliConfig({
  api: {
    projectId: 'your-project-id',
    dataset: 'production'
  },
  server: {
    port: 3334
  }
})

Check Your Setup

Make sure you're:

  • Running the correct command (npx sanity dev or npm run dev)
  • In the correct directory (where your sanity.config.ts file is located)
  • Have installed all dependencies (npm install)

BasePath Configuration

If you've configured a custom basePath in your sanity.config.ts, you'll need to access the Studio at that path. For example, if you set basePath: '/studio', you'd navigate to http://localhost:3333/studio instead of just http://localhost:3333.

The "Cannot GET /" error often appears when the Studio is configured with a basePath but you're trying to access the root URL. Check your config file for any basePath settings.

Still Having Issues?

If none of these work, try:

  1. Deleting node_modules and running npm install again
  2. Making sure you're on Node.js 20 or higher (Studio v4 requirement)
  3. Checking the terminal output for any error messages when starting the dev server

According to the Sanity documentation on localhost:3333, this 404 error typically indicates either something else is running on port 3333 or the Studio server hasn't started properly.

Hey
user M
! This usually happens when you have something else running on port 3333. Is that possible here?

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.

Was this answer helpful?