Skip to content

gmail: Error 400: Precondition check failed., failedPrecondition #645

Description

@profsmallpine

Howdy,

I've searched wide and far on this Precondition check failed error, and I can only find issues where users fix the underlying problem and this is solved. We are seeing this error happening, which then kicks it back into a queue. Once the job retries, the API call is successful. I'm not sure if it's related to this go client, but I have not been able to make any progress on how/why this is occurring. This is how I'm setting up the servoce:

ctx := context.Background()
token := &oauth2.Token{
	AccessToken:  source.AccessToken,
	RefreshToken: source.RefreshToken,
	Expiry:       time.Unix(source.TokenExpiresAt, 0),
}

service, err := gmail.NewService(ctx, option.WithScopes(gmail.GmailReadonlyScope), option.WithTokenSource(s.Config.TokenSource(ctx, token)))
if err != nil {
	return nil, err
}

message, err := service.Users.Messages.Get(authenticatedUser, email.ExternalID).Do()

I find it strange that when it runs again, it is successful, yet this precondition checked failed is an error that we see often in our logs. Sending out a hail mary in case anyone else is seeing this.

Metadata

Metadata

Assignees

Labels

api: gmailIssues related to the Gmail API API.needs more infoThis issue needs more information from the customer to proceed.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions