Join live – Get insights, tips, + Q&A from Sanity developers on our latest releases

CLI errors

You may run into errors while using the CLI. Listed below are some explanations and common solutions for these errors.


Some error explanations may be missing. If you cannot find the error you are looking for, please use the feedback form to let us know.

Unauthorized - You do not have access to the project with ID <projectID>

This error occurs when you run a command without the appropriate permissions. Common causes can be:

  • Incorrect or misspelled project ID in your sanity.json.
  • You don't have the rights to deploy a project. Need to be an Administrator or have a deploy token to do this.
    For example: running sanity graphql deploy with Write or Read+Write access only will give you this error.

Unauthorized - User is missing required grant sanity.project/deployStudio to perform this operation

This error occurs on sanity deploy when you have access to the studio but without the required permissions to deploy.

Unauthorized - Session not found

This can be one of several issues:

  • A temporary issue, please try to run your command again.
  • You have specified an invalid token with the SANITY_AUTH_TOKEN env variable.
  • The session timed out. Try to log out and log in again with the sanity logout and sanity login CLI commands.
  • There was an issue with your logged in user. Try to logout and login again.

Was this article helpful?