Deleting Extensions from the Open VSX registry

You can remove extensions from your private Open VSX registry by using one of the following methods:

  • Use the Open VSX administrator API (recommended).

  • Delete the extension data directly in the PostgreSQL database.

Deleting an extension by using the Open VSX administrator API

Delete an extension from your private Open VSX registry by calling the administrator API with an administrator user and a personal access token (PAT).

Prerequisites
  • You have access to the OpenShift cluster where Open VSX is deployed (namespace openvsx).

Procedure
  1. Add the Open VSX administrator user and PAT to the database:

    Get the PostgreSQL pod name:

    export POSTGRESQL_POD_NAME=$(oc get pods -n openvsx \
       -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1)

    Add the administrator user:

    oc exec -n openvsx "$POSTGRESQL_POD_NAME" -- bash -c \
       "psql -d openvsx -c \"INSERT INTO user_data (id, login_name, role) VALUES (1002, 'openvsx-admin', 'admin');\""

    Add the administrator PAT:

    oc exec -n openvsx "$POSTGRESQL_POD_NAME" -- bash -c \
       "psql -d openvsx -c \"INSERT INTO personal_access_token (id, user_data, value, active, created_timestamp, accessed_timestamp, description) VALUES (1002, 1002, 'openvsx_admin_token', true, current_timestamp, current_timestamp, 'Admin API Token');\""

    Use a strong, unique value instead of openvsx_admin_token for production. The system passes the PAT in the API request URL.

  2. To delete an extension and all of its published versions, use the curl command with the following endpoint:

    POST /admin/api/extension/<publisher>/<extension>/delete

    curl -X POST \
      "https://<your-openvsx-server-url>/admin/api/extension/<publisher>/<extension>/delete?token=<your-admin-pat>"

    Replace the following placeholders:

    • <your-openvsx-server-url>: The URL of your Open VSX registry.

    • <publisher>: The namespace of the extension (for example, redhat).

    • <extension>: The name of the extension (for example, vscode-yaml).

    • <your-admin-pat>: The PAT you created for the openvsx-admin user.

  3. To delete a specific version of an extension, send a JSON body in the same POST request:

    To remove only certain versions and target platforms instead of the entire extension, include an array that specifies a version and targetPlatform (for example, linux-x64, darwin-arm64, or win32-x64).

    curl -X POST \
      -H "Content-Type: application/json" \
      -d '[{"version": "1.3.0", "targetPlatform": "linux-x64"}]' \
      "https://<your-openvsx-server-url>/admin/api/extension/<publisher>/<extension>/delete?token=<your-admin-pat>"

    Use the same placeholders that are listed in the previous step. You can list multiple version and platform pairs in the JSON array to delete several targets in one request.

Verification
  • Refresh your Open VSX registry and verify that the extension no longer appears in the gallery.

Deleting an extension from the PostgreSQL database directly

Remove extension records and related data directly in the PostgreSQL database when the administrator API is not available or when you must clean up specific data. If the extension uses local storage, you must also remove its files from the Open VSX server pod.

Prerequisites
  • You have access to the OpenShift cluster where Open VSX is deployed (namespace openvsx).

  • You know the namespace name and extension name that you want to delete.

Procedure
  1. Open a command prompt in the PostgreSQL pod and connect to the database:

    export POSTGRESQL_POD_NAME=$(oc get pods -n openvsx \
       -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1)
    oc exec -it $POSTGRESQL_POD_NAME -n openvsx -- /bin/bash

    Inside the pod, run psql:

    psql

    At the postgres=# prompt, connect to the database:

    \c openvsx

    You are now connected to the openvsx database as the postgres user.

  2. Find the namespace ID and extension ID:

    Identify the namespace ID. Replace <namespace_name> with the actual namespace:

    SELECT id, name FROM namespace WHERE name = '<namespace_name>';

    Identify the extension ID. Replace <namespace_id> and <extension_name> with the values from the previous query:

    SELECT id, name, namespace_id FROM extension WHERE namespace_id = <namespace_id> AND name = '<extension_name>';

    Note the ID of the extension to use as <extension_id> in the next steps.

  3. Optional: Preview extension versions and file resources:

    Preview the versions:

    SELECT id, version, pre_release, semver_pre_release, semver_is_pre_release FROM extension_version WHERE extension_id = <extension_id> ORDER BY timestamp DESC;

    Preview the file resources:

    SELECT id, name, type, storage_type FROM file_resource WHERE extension_id = <extension_id> ORDER BY id;

    If the storage_type value is local, you must also remove the extension files from the file system on the Open VSX server pod.

  4. Delete the extension from the database:

    Run the following commands in a single transaction. Replace <extension_id> with the extension ID from step 2.

    BEGIN;
    -- 1. Delete all file resources for the extension
    DELETE FROM file_resource WHERE extension_id = <extension_id>;
    -- 2. Delete all extension reviews
    DELETE FROM extension_review WHERE extension_id = <extension_id>;
    -- 3. Delete all versions of the extension
    DELETE FROM extension_version WHERE extension_id = <extension_id>;
    -- 4. Delete the extension entry itself
    DELETE FROM extension WHERE id = <extension_id>;
    COMMIT;

    Run these commands in order within one transaction. Do not skip the COMMIT command, or the system does not apply the changes.

  5. If applicable, remove the extension files from local storage:

    If the extension used local storage, remove its files from the Open VSX server pod.

    Get the Open VSX server pod name:

    export OPENVSX_POD_NAME=$(oc get pods -n openvsx -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^openvsx-server' | head -n 1)

    Access the pod and delete the extension folder for the publisher and extension you removed:

    oc exec -it $OPENVSX_POD_NAME -n openvsx -- /bin/bash -c "rm -rf /tmp/extensions/<publisher>/<extension>"
Verification
  • Refresh your Open VSX registry and verify that the extension no longer appears in the gallery.