microg/GmsCore · error · IllegalStateException
Value is not a float.
Error message
Value is not a float.
What it means
Format guard in fitness Value.asFloat: the Value's format is not FORMAT_FLOAT (stored as int, string, or map), so the internal representation cannot be safely returned as a float. The mismatch between the field's declared format and the accessor is at fault.
Source
Thrown at play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java:86
/**
* Returns the value of this object as an activity. The integer representation of the activity is converted to a String prior to returning.
*
* @return One of the constants from {@link FitnessActivities}; {@link FitnessActivities#UNKNOWN} if the object does not hold a valid activity
* representation
* @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_INT32}
*/
public String asActivity() {
return null; // TODO
}
/**
* Returns the value of this object as a float.
*
* @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_FLOAT}
*/
public float asFloat() {
if (format != FORMAT_FLOAT) throw new IllegalStateException("Value is not a float.");
return value;
}
/**
* Returns the value of this object as a int.
*
* @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_INT32}
*/
public int asInt() {
if (format != FORMAT_INT32) throw new IllegalStateException("Value is not a int.");
return Float.floatToRawIntBits(this.value);
}
/**
* Returns the value of this object as a string.
*
* @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_STRING}
*/View on GitHub (pinned to 157c9d86ac)
Solutions
- Check getFormat() against Field.FORMAT_FLOAT before calling asFloat()
- Use the accessor matching the value's actual format (asInt/asString)
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java:86 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/270596fb379887a9.
Report an issue: GitHub.