Home›Developer docs›Errors

Errors and what to do

Updated Nov 13, 20263 min read

The errors your SashiDo app returns, what they usually mean and how to fix them. Parse error codes, permission errors, session errors, cloud code errors, and the Management API's errors.

Your app's API answers errors as JSON with a numeric code and a message:

{ "code": 101, "error": "Object not found." }

The SDKs turn it into a Parse.Error with code and message. Check the code, not the text: messages can change between Parse Server versions.

try {
  await query.get(id);
} catch (e) {
  if (e.code === Parse.Error.OBJECT_NOT_FOUND) { /* gone, or not yours */ }
  else if (e.code === Parse.Error.INVALID_SESSION_TOKEN) { await Parse.User.logOut(); /* log in again */ }
  else throw e;
}

The ones you'll meet

Code Name Usually means What to do
101 OBJECT_NOT_FOUND The object doesn't exist, or the user may not read it (ACL). Also wrong username or password at login Check the ACL and who is logged in
119 OPERATION_FORBIDDEN A class-level permission refuses the operation, or it needs the master key Check the class's CLP, or do it in a cloud function
141 SCRIPT_FAILED A cloud function or trigger threw an error The message is the thrown error; see Core › Logs
142 VALIDATION_ERROR A trigger refused the object Show the message to the user
209 INVALID_SESSION_TOKEN The session expired or was revoked (e.g. password change) Log the user out and in again
206 SESSION_MISSING The operation needs a logged-in user Log in first
202 / 203 USERNAME_TAKEN / EMAIL_TAKEN Sign-up with an existing username or email Ask for another, or offer login
205 EMAIL_NOT_FOUND Password reset or verification for an unknown email
137 DUPLICATE_VALUE A unique index refused a value
111 INCORRECT_TYPE A field got a value of another type than its schema Fix the value, or the schema
105 INVALID_KEY_NAME A field name isn't allowed (e.g. starts with $) Rename the field
102 INVALID_QUERY The query is malformed, or uses an operator the version doesn't support Check the query

Parse's full list of codes has the rest.

Without a code

Answer Means What to do
403 {"error": "unauthorized"} Wrong Application ID or client key, or a key the app doesn't accept Copy the keys again from App Settings › Security & Keys
403 {"error": "unauthorized: master key is required"} The operation needs the master key Do it in cloud code or with an access token
502, 503 The app is starting or restarting, e.g. during a deployment Retry with a backoff; check Runtime › Deployments
No answer after 60 seconds The request ran past the time limit Make it smaller, add an index, or move the work to a job

Errors from cloud code

What you throw is what the client gets. Throw a Parse.Error with a fitting code, so clients can handle it:

throw new Parse.Error(Parse.Error.VALIDATION_ERROR, 'A title is required.');

Anything else thrown (a bug, a failed call to another service) reaches the client as 141 SCRIPT_FAILED with its message, and is logged in Core › Logs. Don't put secrets in error messages: the client sees them.

The Management API

The API used with access tokens has its own error format and codes (300 to 305 for tokens and the proxy): see Errors in the API reference.

Find the cause faster

  • Core › Logs shows each cloud code error with its stack trace.
  • Through MCP, *"show me the errors from the last hour and find the code that throws them"* reads the logs and the cloud code together.

Reading this with an AI assistant? This page as Markdown.