microg/GmsCore · error · IllegalStateException
Value is not a map.
Error message
Value is not a map.
What it means
Format guard fired from Value's map operations (e.g. clearKey): the Value's format is not a map format, so per-key mutation is impossible. The calling code assumed a map-typed Value for a field declared with another format.
Source
Thrown at play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java:120
*
* @throws IllegalStateException If this {@link Value} does not correspond to a {@link com.google.android.gms.fitness.data.Field#FORMAT_STRING}
*/
@NonNull
public String asString() {
if (format != FORMAT_STRING) throw new IllegalStateException("Value is not a string.");
if (stringValue == null) return "";
return stringValue;
}
/**
* Clears any value currently associated with the given {@code key} in the map. This method can be used only on map values.
*
* @param key The key you're modifying.
* @deprecated Use {@link DataPoint.Builder} to construct new {@link DataPoint} instances.
*/
@Deprecated
public void clearKey(String key) {
if (format != FORMAT_MAP) throw new IllegalStateException("Value is not a map.");
if (mapValue != null) {
mapValue.remove(key);
}
}
/**
* Returns the format of this value, which matches the appropriate field in the data type definition.
*
* @return One of the format constants from {@link com.google.android.gms.fitness.data.Field}.
*/
public int getFormat() {
return format;
}
/**
* Returns the value of the given key in the map as a {@link Float}.
*
* @return {@code null} if the key doesn't have a set value in the map.View on GitHub (pinned to 157c9d86ac)
Solutions
- Confirm the data type's field is map-formatted before using map methods
- Use the appropriate accessor for the Value's actual format
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:120 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/078fcf0e8727d464.
Report an issue: GitHub.