Skip to content
This repository was archived by the owner on Aug 30, 2026. It is now read-only.
This repository was archived by the owner on Aug 30, 2026. It is now read-only.

Wrong Exception Message in Transactions #1183

Description

@shiva-6

I understand internally we use writebatch for transactions but the error messages should be related to feature. So, If I was using transactions outside the method, It throws an exception but saying writebatch has been already commited rather than saying transaction.

Environment details

  1. API : runTransaction
  2. OS type and version: windows11
  3. Java version: 1.8
  4. version(s):

Steps to reproduce

  1. I have added sample code, Please check to reproduce the issue

Code example

// example
   public static void solve() {
        // Create your client
        // Firestore firestoreClient = 
        Transaction t = null;
        try {
            t = firestoreClient.runTransaction(transaction -> {
                // do something
                return transaction;
            }).get();
            t.get(firestoreClient.document("users/me"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

Stack trace

java.lang.IllegalStateException: Cannot modify a WriteBatch that has already been committed. at com.google.common.base.Preconditions.checkState(Preconditions.java:502) at com.google.cloud.firestore.UpdateBuilder.verifyNotCommitted(UpdateBuilder.java:158) at com.google.cloud.firestore.UpdateBuilder.performUpdate(UpdateBuilder.java:519) at com.google.cloud.firestore.UpdateBuilder.update(UpdateBuilder.java:356)

External references such as API reference guides

Any additional information below

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: firestoreIssues related to the googleapis/java-firestore API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions