yuliskov/SmartTube · error · UnsupportedOperationException

Insert is not implemented.

Error message

Insert is not implemented.

What it means

VideoContentProvider only implements query() for search suggestions; its data is a synthesized cache of MediaItems pulled from the media service, not a writable store. insert() therefore unconditionally throws UnsupportedOperationException('Insert is not implemented.') to fail fast on any write attempt.

Source

Thrown at leanbackassistant/src/main/java/com/liskovsoft/leanbackassistant/search/VideoContentProvider.java:236

            mediaItem.getRatingStyle(),
            mediaItem.getRatingScore(),
            mediaItem.getProductionDate(),
            mediaItem.getDurationMs(),
            "GLOBALSEARCH",
            mediaItem.getId()
        };
    }

    @Nullable
    @Override
    public String getType(@NonNull Uri uri) {
        return null;
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) {
        throw new UnsupportedOperationException("Insert is not implemented.");
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String s, @Nullable String[] strings) {
        throw new UnsupportedOperationException("Delete is not implemented.");
    }

    @Override
    public int update(
            @NonNull Uri uri,
            @Nullable ContentValues contentValues,
            @Nullable String s,
            @Nullable String[] strings) {
        throw new UnsupportedOperationException("Update is not implemented.");
    }
}

View on GitHub (pinned to 3de8d90593)

Solutions

  1. Do not call insert() on this provider — it is read-only by design; read search suggestions via query() only.
  2. Route writes to the real data source (the app's channels/playlists and the media service APIs) instead of the search provider.
  3. If you maintain a fork that genuinely needs writes, implement insert() against your own storage rather than leaving the throw.

Example fix

// before
getContentResolver().insert(searchUri, values); // throws UnsupportedOperationException

// after — the provider is read-only; write to the actual data source
// (e.g. update channels/playlists through the app's own API) and only
// query() the search provider.
Defensive patterns

Strategy: try-catch

Validate before calling

// nothing to validate — insert is unconditionally unsupported;
// just never call it on the search provider

Try / catch

try {
    getContentResolver().insert(searchUri, values);
} catch (UnsupportedOperationException e) { // Insert is not implemented
    Log.w(TAG, "Search provider is read-only: " + searchUri);
    // route the write to the app's real data source instead
}

Prevention

When it happens

Trigger: Any getContentResolver().insert(uri, values) call targeting this provider's authority; sync adapters or generic content tooling that assume every ContentProvider supports full CRUD.

Common situations: A generic sync framework or backup tool probing all declared providers; a developer assuming ContentProvider requires all six operations; automated tests iterating CRUD calls over every provider in the manifest.

Related errors


AI-assisted analysis of yuliskov/SmartTube@3de8d90593 (2026-08-22). Data as JSON: /api/errors/66bebbff2a05d94b. Report an issue: GitHub.