{"record":{"id":"30b5293edaa65790","repo":"microg/GmsCore","slug":"value-is-not-a-int","errorCode":null,"errorMessage":"Value is not a int.","messagePattern":"Value is not a int\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java","lineNumber":96,"sourceCode":"    }\n\n    /**\n     * Returns the value of this object as a float.\n     *\n     * @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_FLOAT}\n     */\n    public float asFloat() {\n        if (format != FORMAT_FLOAT) throw new IllegalStateException(\"Value is not a float.\");\n        return value;\n    }\n\n    /**\n     * Returns the value of this object as a int.\n     *\n     * @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_INT32}\n     */\n    public int asInt() {\n        if (format != FORMAT_INT32) throw new IllegalStateException(\"Value is not a int.\");\n        return Float.floatToRawIntBits(this.value);\n    }\n\n    /**\n     * Returns the value of this object as a string.\n     *\n     * @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_STRING}\n     */\n    @NonNull\n    public String asString() {\n        if (format != FORMAT_STRING) throw new IllegalStateException(\"Value is not a string.\");\n        if (stringValue == null) return \"\";\n        return stringValue;\n    }\n\n    /**\n     * Clears any value currently associated with the given {@code key} in the map. This method can be used only on map values.\n     *","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java#L78-L114","documentation":"Format guard in fitness Value.asInt: the Value's format is not FORMAT_INT32, so Float.floatToRawIntBits on the stored value would be meaningless. It fires when the accessor does not match the field's data format.","triggerScenarios":"Thrown at play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java:96 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify getFormat() == Field.FORMAT_INT32 before calling asInt()","Read the value with asFloat()/asString() according to the actual format"],"exampleFix":null,"handlingStrategy":"type-guard","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"}