microg/GmsCore · error · IllegalArgumentException

Asset fd cannot be null

Error message

Asset fd cannot be null

What it means

Null-check on the sole parameter of Asset.createFromFd. The wearable Asset is being built around a ParcelFileDescriptor (the asset's content is a file to transfer), so a null fd leaves the asset with no content source; the factory rejects it with IllegalArgumentException rather than constructing an unusable Asset.

Source

Thrown at play-services-wearable/src/main/java/com/google/android/gms/wearable/Asset.java:76

        this.digest = digest;
        this.fd = fd;
        this.uri = uri;
    }

    /**
     * Creates an Asset using a byte array.
     */
    public static Asset createFromBytes(byte[] assetData) {
        return null;
    }

    /**
     * Creates an Asset using a file descriptor. The FD should be closed after being successfully
     * sent in a putDataItem request.
     */
    public static Asset createFromFd(ParcelFileDescriptor fd) {
        if (fd == null) {
            throw new IllegalArgumentException("Asset fd cannot be null");
        }
        return new Asset(null, null, fd, null);
    }

    /**
     * Create an Asset using an existing Asset's digest.
     */
    public static Asset createFromRef(String digest) {
        if (digest == null) {
            throw new IllegalArgumentException("Asset digest cannot be null");
        }
        return new Asset(null, digest, null, null);
    }

    /**
     * Creates an Asset using a content URI. Google Play services must have permission to read this
     * Uri.
     */

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Open the file and pass a non-null ParcelFileDescriptor before calling createFromFd
  2. Skip sending the asset when the file cannot be opened
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at play-services-wearable/src/main/java/com/google/android/gms/wearable/Asset.java:76 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/16ea2a761747ced9. Report an issue: GitHub.