{"record":{"id":"ebde096f581aca97","repo":"microg/GmsCore","slug":"missing-image-data-call-either-setbitmap-or-seti","errorCode":null,"errorMessage":"Missing image data.  Call either setBitmap or setImageData to specify the image","messagePattern":"Missing image data\\.  Call either setBitmap or setImageData to specify the image","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"play-services-vision-common/src/main/java/com/google/android/gms/vision/Frame.java","lineNumber":87,"sourceCode":"    public Frame.Metadata getMetadata() {\n        return metadata;\n    }\n\n    /**\n     * Builder for creating a frame instance.\n     * At a minimum, image information must be specified either through {@link #setBitmap(Bitmap)} or {@link #setImageData(ByteBuffer, int, int, int)}.\n     */\n    public static class Builder {\n        private final Frame frame = new Frame();\n\n        /**\n         * Creates the frame instance.\n         *\n         * @throws IllegalStateException if the image data has not been set via {@link #setBitmap(Bitmap)} or {@link #setImageData(ByteBuffer, int, int, int)}.\n         */\n        public Frame build() {\n            if (this.frame.bitmap == null && this.frame.imageData == null) {\n                throw new IllegalStateException(\"Missing image data.  Call either setBitmap or setImageData to specify the image\");\n            }\n            return frame;\n        }\n\n        /**\n         * Sets the image data for the frame from a supplied bitmap.\n         * <p>\n         * While this is a convenient way to specify certain images (e.g., images read from a file), note that a copy is required to extract pixel information for use in detectors -- this could mean extra GC overhead. Using {@link #setImageData(ByteBuffer, int, int, int)} is the preferred way to specify image data if you can handle the data in a supported byte format and reuse the byte buffer, since it does not require a making a copy.\n         */\n        public Builder setBitmap(Bitmap bitmap) {\n            this.frame.bitmap = bitmap;\n            this.frame.metadata.width = bitmap.getWidth();\n            this.frame.metadata.height = bitmap.getHeight();\n            return this;\n        }\n\n        /**\n         * Sets the frame ID. A frame source such as a live video camera or a video player is expected to assign IDs in monotonically increasing order, to indicate the sequence that the frame appeared relative to other frames.","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-vision-common/src/main/java/com/google/android/gms/vision/Frame.java#L69-L105","documentation":"Thrown by Frame.Builder.build() when neither setBitmap() nor setImageData() was called on the builder. A Frame must wrap actual image pixels for vision detectors to process; this exception means the builder was used to set only metadata (id, rotation, etc.) and the frame was built without any image content, so there is nothing to analyze.","triggerScenarios":"Thrown at play-services-vision-common/src/main/java/com/google/android/gms/vision/Frame.java:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call setBitmap(bitmap) or setImageData(buffer, width, height, format) before build()","Track whether image data was supplied and skip building otherwise"],"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-14T00:17:10.932Z"}