{"record":{"id":"16ea2a761747ced9","repo":"microg/GmsCore","slug":"asset-fd-cannot-be-null","errorCode":null,"errorMessage":"Asset fd cannot be null","messagePattern":"Asset fd cannot be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"play-services-wearable/src/main/java/com/google/android/gms/wearable/Asset.java","lineNumber":76,"sourceCode":"        this.digest = digest;\n        this.fd = fd;\n        this.uri = uri;\n    }\n\n    /**\n     * Creates an Asset using a byte array.\n     */\n    public static Asset createFromBytes(byte[] assetData) {\n        return null;\n    }\n\n    /**\n     * Creates an Asset using a file descriptor. The FD should be closed after being successfully\n     * sent in a putDataItem request.\n     */\n    public static Asset createFromFd(ParcelFileDescriptor fd) {\n        if (fd == null) {\n            throw new IllegalArgumentException(\"Asset fd cannot be null\");\n        }\n        return new Asset(null, null, fd, null);\n    }\n\n    /**\n     * Create an Asset using an existing Asset's digest.\n     */\n    public static Asset createFromRef(String digest) {\n        if (digest == null) {\n            throw new IllegalArgumentException(\"Asset digest cannot be null\");\n        }\n        return new Asset(null, digest, null, null);\n    }\n\n    /**\n     * Creates an Asset using a content URI. Google Play services must have permission to read this\n     * Uri.\n     */","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-wearable/src/main/java/com/google/android/gms/wearable/Asset.java#L58-L94","documentation":"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.","triggerScenarios":"Thrown at play-services-wearable/src/main/java/com/google/android/gms/wearable/Asset.java:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the file and pass a non-null ParcelFileDescriptor before calling createFromFd","Skip sending the asset when the file cannot be opened"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}