{"record":{"id":"078fcf0e8727d464","repo":"microg/GmsCore","slug":"value-is-not-a-map","errorCode":null,"errorMessage":"Value is not a map.","messagePattern":"Value is not a map\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java","lineNumber":120,"sourceCode":"     *\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     *\n     * @param key The key you're modifying.\n     * @deprecated Use {@link DataPoint.Builder} to construct new {@link DataPoint} instances.\n     */\n    @Deprecated\n    public void clearKey(String key) {\n        if (format != FORMAT_MAP) throw new IllegalStateException(\"Value is not a map.\");\n        if (mapValue != null) {\n            mapValue.remove(key);\n        }\n    }\n\n    /**\n     * Returns the format of this value, which matches the appropriate field in the data type definition.\n     *\n     * @return One of the format constants from {@link com.google.android.gms.fitness.data.Field}.\n     */\n    public int getFormat() {\n        return format;\n    }\n\n    /**\n     * Returns the value of the given key in the map as a {@link Float}.\n     *\n     * @return {@code null} if the key doesn't have a set value in the map.","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java#L102-L138","documentation":"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.","triggerScenarios":"Thrown at play-services-fitness/src/main/java/com/google/android/gms/fitness/data/Value.java:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the data type's field is map-formatted before using map methods","Use the appropriate accessor for the Value's 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"}