Request Errors

Request Errors

A Classroom API error can contain an error code to help you identify the cause and properly handle the error. Depending on the code, you might retry the request or direct users to take certain action.

This page details the possible error codes, grouped by HTTP code. To read more about the error message's structure, refer to Error Message Structure.

This page details the possible error codes, grouped by HTTP code. See the reference documentation to determine which methods return any particular error code.

HTTP 400: FAILED_PRECONDITION

A FAILED_PRECONDITION is returned when the user attempts an action that cannot be permitted, either because the user has hit a limit or an application state, such as CourseNotModifiable. To fix a FAILED_PRECONDITION, instruct the user to take some action and then retry. Or, in some cases, you might use alternative endpoints to fix the state on behalf of the user.

PendingInvitationExists

PendingInvitationExists indicates someone has already been invited to take ownership of the course. This error occurs during course ownership transfer when a transfer was previously started but has not yet been accepted by the new owner.

CourseMemberLimitReached

CourseMemberLimitReached indicates that the attempted action would exceed the maximum allowed number of course members. This code is typically returned by the students.create() For further information, refer to the "Class size limits" section of the Invite students to a class help center article.

Possible Action: Describe the cause of the failure and suggest that the user remove unnecessary course members

CourseNotModifiable

CourseNotModifiable indicates that the relevant course is in a state that doesn't allow its properties to be modified (other than the course state itself).

Possible Action: Prompt the user to change the course to a modifiable course state. To change the state, use courses.patch(). The course state can be changed in a request that changes other properties.

CourseTeacherLimitReached

CourseTeacherLimitReached indicates that the requested action would exceed the maximum allowed number of course teachers. This code is typically returned by the teachers.create(). For further information, refer to the "Class size limitations" section of the Add a co-teacher to a class help center article.

Possible Action: Describe the cause of the failure and suggest that the user remove unnecessary course teachers. If applicable to your app, you can use teachers.delete() to manage teacher rosters on behalf of the user.

UserGroupsMembershipLimitReached

UserGroupsMembershipLimitReached indicates that the user is already a member of the maximum allowed number of groups and can't join any courses. This code is typically returned by students.create() or teachers.create(). For further information, refer to the "Class size limitations" section of the Invite students to a class help center article.

Possible Action: Describe the cause of the failure and suggest that the user leave any courses in which they are not participating. The user may consider creating an additional account if they need to participate in more courses. If applicable to your app, you can use students.create() or teachers.delete() to manage rosters on behalf of the user.

AttachmentNotVisible

AttachmentNotVisible indicates that one or more attachments specified are either not visible to the user, not of the requested type, or do not exist. For example, Drive items that haven’t been shared to the user would return this error.

Possible Action: Describe the cause of the failure and suggest that the user recheck the identifiers, such as Drive file IDs, they have included. Also, ensure the user has the proper permissions to view the attachment.

CannotRemoveCourseFolderOwner

CannotRemoveCourseFolderOwner indicates that the owner of the course Drive folder may not be removed.

Possible Action: Describe the cause of the failure and suggest that the user transfer ownership of the course Drive folder to a different user and try again.

CannotRemoveCourseOwner

CannotRemoveCourseOwner indicates that the course owner may not be removed.

Possible Action: Describe the cause of the failure and suggest that the course owner may not be removed. In most cases, the user is trying to remove themselves which is not allowed.

CannotRemoveCourseOwnerTransferIncomplete

CannotRemoveCourseOwnerTransferIncomplete indicates that the course owner may not be removed because the ownership transfer of this class is still in progress.

Possible Action: Describe the cause of the failure and suggest that the user wait a few moments for the asynchronous action of transferring ownership of the class to complete, then try again.

CannotRemoveTeacherWithNoCourseOwner

CannotRemoveTeacherWithNoCourseOwner indicates that a teacher may not be removed from a course with no owner.

Possible Action: Describe the cause of the failure and suggest that the teacher may not be removed. In most cases, the course owner's user account was deleted, causing an invalid course state.

InactiveCourseOwner

InactiveCourseOwner indicates that the requested action is not permitted because the course owner's account is deleted. The admin of the course owner needs to restore the course owner's account before taking the requested action.

Possible Action: Describe the cause of the failure and suggest that the admin restore the course owner's account before retrying the operation.

IneligibleOwner

IneligibleOwner indicates that the user cannot be added as the owner of the course because the user is not a co-teacher.

Possible Action: Describe the cause of the failure. If the requesting user is not an admin, suggest that they first send the user an invitation to be a teacher in the course before updating the owner. If the requesting user is an admin, suggest that they first add the user as a co-teacher of the course.

UserCannotOwnCourse

UserCannotOwnCourse indicates that the user cannot be added as the owner of the course.

Possible Action: Describe the cause of the failure and suggest that the course cannot be created with the user as the course owner. A non-admin requesting user may see this error if they try to create a course with a user other than themselves as the owner. An admin requesting user may see this error if the user account specified as the owner does not exist or the user is not in their domain.

HTTP 429: RESOURCE_EXHAUSTED

The RESOURCE_EXHAUSTED is returned when the requested action is not permitted because some resource, such as quota or server capacity, is exhausted. These types of request errors typically occur because your app produced an excessive load.

To avoid triggering these limits and increase the reliability of your application, use retry mechanisms. Valid retry mechanisms include:

  • Use truncated exponential backoff to retry the request and maximize throughput of requests in concurrent environments.

  • To avoid collisions, consider truncated exponential backoff with jitter. Introducing jitter can help your requests succeed faster by introducing a randomized delay that spreads out spikes in requests.

If your application returns RESOURCE_EXHAUSTED errors due to quota limitations, submit a quota increase. For further information, refer to the Monitor API quotas help center article.

UserCourseJoinRateLimitReached

UserCourseJoinRateLimitReached indicates that the user has already joined the maximum allowed number of courses in one day. For further information, refer to the "Group invitations and size" section of the Understand Groups policies and limits help center article.

Possible Action: Describe the cause of the failure and suggest that the user waits one day before joining the course.

HTTP 500: INTERNAL

INTERNAL indicates that an unexpected error arose while processing the request. INTERNAL request errors can also often be solved by using exponential backoff to retry the request. If an INTERNAL error persists, it can be reported by filing a bug on the Classroom API public issue tracker.