Summary
On a fresh install with no existing buckets, BackgroundService logs a confusing warning about hostname migration JSON parsing failure, even though the migration trivially succeeds (0 buckets to migrate).
Logcat Output (fresh install)
I BackgroundService: Hostname migration result: Migrated hostname for 0 bucket(s)
W BackgroundService: Migration result was not valid JSON; will retry on next start
W BackgroundService: Hostname migration reported failure; will retry on next start
Root Cause
The hostname migration calls the native library which returns a string. On fresh install (no existing data), the return value appears to be either empty or not valid JSON, so the JSON parsing step fails and logs a warning — even though the actual migration had nothing to do (0 buckets).
Impact
- No user impact (fresh install has no buckets to migrate)
- Logcat noise makes debugging harder
- The "will retry on next start" retry is redundant since there's nothing to migrate
Suggested Fix
Before attempting to parse the migration result as JSON, check if there are any existing buckets to migrate. If 0 buckets exist, skip the JSON parsing step and return success silently.
Or: check if the result string is empty/null before logging a warning.
Environment
Summary
On a fresh install with no existing buckets,
BackgroundServicelogs a confusing warning about hostname migration JSON parsing failure, even though the migration trivially succeeds (0 buckets to migrate).Logcat Output (fresh install)
Root Cause
The hostname migration calls the native library which returns a string. On fresh install (no existing data), the return value appears to be either empty or not valid JSON, so the JSON parsing step fails and logs a warning — even though the actual migration had nothing to do (0 buckets).
Impact
Suggested Fix
Before attempting to parse the migration result as JSON, check if there are any existing buckets to migrate. If 0 buckets exist, skip the JSON parsing step and return success silently.
Or: check if the result string is empty/null before logging a warning.
Environment