microg/GmsCore · error · RuntimeException
pageContent is null
Error message
pageContent is null
What it means
loadFamilyManagementPageContent throws RuntimeException("pageContent is null") when the family management page content API returns a null response body, so the page data cannot be parsed. It converts an empty API result into an explicit error surfaced to the UI.
Source
Thrown at play-services-core/src/main/kotlin/com/google/android/gms/family/v2/manage/model/FamilyViewModel.kt:135
}
}
}
}
fun loadFamilyManagementPageContent(
context: Context,
accountName: String,
appId: String,
memberId: String,
leaveFamily: Boolean = false
) {
viewModelScope.launch {
runCatching {
_uiState.update { it.copy(isLoading = true, isError = false) }
val oauthToken = requestOauthToken(context, accountName, SERVICE_FAMILY_SCOPE)
val currentMember = getCurrentMember(context, accountName, appId, oauthToken)
val pageContent = FamilyApiClient.loadFamilyManagementPageContent(context, oauthToken, appId, memberId, currentMember, leaveFamily)
pageContent?.body?.parseToPageData() ?: throw RuntimeException("pageContent is null")
}.onFailure { throwable ->
_uiState.update { it.copy(isLoading = false, isError = true) }
_familyChangedStateState.value = FamilyChangedState.Error(throwable.message ?: "", 4)
Log.d(TAG, "loadFamilyManagementPageContent error", throwable)
}.onSuccess { pageData ->
_uiState.update {
it.copy(
isLoading = false,
title = pageData.sectionMap.getValue(FAMILY_PAGE_CONTENT_TITLE_INDEX),
pageData = pageData
)
}
}
}
}
fun validatePassword(
context: Context,View on GitHub (pinned to 157c9d86ac)
Solutions
- Validate the oauth token and memberId before the call; re-authenticate if needed
- Make loadFamilyManagementPageContent throw on HTTP errors instead of returning null
- Treat a null body as an empty-content state where appropriate instead of an error
- The onFailure branch already updates UI state; add retry logic there
Example fix
// before
pageContent?.body?.parseToPageData() ?: throw RuntimeException("pageContent is null")
// after
val body = pageContent?.body
val pageData = body?.parseToPageData()
if (pageData == null) {
_familyChangedStateState.value = FamilyChangedState.Error("No page content", 4)
return@runCatching
} Defensive patterns
Strategy: validation
Validate before calling
val oauthToken = requestOauthToken(context, accountName, SERVICE_FAMILY_SCOPE)
require(memberId.isNotBlank()) { "memberId required" }
// then check the response body before parsing
val body = pageContent?.body ?: error("page content body missing") Type guard
fun <T> Response<T>?.bodyOrNull(): T? = this?.body
Try / catch
runCatching {
loadAndParsePage()
}.onFailure { t ->
_familyChangedStateState.value = FamilyChangedState.Error(t.message ?: "", 4)
} Prevention
- Re-authenticate when tokens may be stale before loading page content
- Validate memberId/appId inputs before the API call
- Prefer APIs that throw on HTTP errors over ones returning null
When it happens
Trigger: FamilyApiClient.loadFamilyManagementPageContent returns null (request failed silently or server returned no body) — happens with invalid oauth token, unknown memberId, or leaveFamily flows with no page content to render.
Common situations: Opening the family management page with a stale token, a memberId that no longer exists, or backend responses with empty bodies.
Related errors
- familyResponse is null
- Signature invalid
- Network URL required
- IntegrityErrorCode.NETWORK_ERROR
- deleteAll was set to true but keys were also provided
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/57a198f4c3ef820f.
Report an issue: GitHub.