aleph icon indicating copy to clipboard operation
aleph copied to clipboard

BUG: Cannot delete investigations

Open shabasma opened this issue 4 months ago • 5 comments

Describe the bug When we try to delete an investigation, we get the error message "This path does not exist." The collection does not appear in the database or the redis cache. We tried to delete it from the cli alephclient and curl, same error. This investigation appears in https://aleph.example.com/investigations list though.

To Reproduce Steps to reproduce the behavior:

  1. Go to investigations
  2. Click on an investigation
  3. See error "This path does not exist."

or

curl -X DELETE "https://aleph.example.com/api/2/investigations/383"      -H "Authorization: ApiKey XXX" 
{"status": "error", "message": "This path does not exist."}

or

$alephclient --host https://aleph-aws.lemonde.fr --api-key XXX delete -f 383
Error: Collection does not exist.
$ alephclient --host https://aleph-aws.lemonde.fr --api-key XXX flush -f 383
Error: Collection does not exist.
$ alephclient --host https://aleph-aws.lemonde.fr --api-key XXX touch -f 383
Error: Collection does not exist.

Expected behavior Web console: the option to delete the investigation and confirm CLI or curl: deletion successful

Aleph version 4.0.2

Screenshots

Image

Additional context We migrated our aleph data to a new infra: elasticsearch, database, etc. and upgraded at the same time from version 3 to 4.0.2

shabasma avatar Sep 02 '25 10:09 shabasma

Hi @shabasma , just to rule this out: I'm assuming you are using an API Key that belongs to an admin users (or at least one with write access to that collection)?

stchris avatar Sep 02 '25 10:09 stchris

And are you able to test this workaround: using the aleph cli (not alephclient, but the one you access from a shell in a live running Aleph container) is aleph delete <FOREIGN_ID> working for you?

stchris avatar Sep 02 '25 10:09 stchris

Hello Chris, Yes I'm using an admin API KEY The aleph workaround does not work Image

Also, the collection has no foreign ID associated

DB:

SELECT id, foreign_id, label, summary, created_at, updated_at FROM collection WHERE id = 383;
 id | foreign_id | label | summary | created_at | updated_at
----+------------+-------+---------+------------+------------
(0 rows)

Redis

 keys *Collection:383*
(empty array)

And yet we see it in the /investigations web page

Image

shabasma avatar Sep 02 '25 12:09 shabasma

The collection id corresponds to the id column in the collection table of the postgres ALEPH_DATABASE, but the foreign_id is something different (typically it looks like an UUID). You can find it in the right hand column in the collection overview.

For instance for https://aleph.occrp.org/datasets/2226 it is on the bottom right:

Image

stchris avatar Sep 02 '25 12:09 stchris

Hi there!

So actually, this issue occured when transferring our instance from one cloud provider to another. I don't know how we arrived there, we must have done something wrong but there must be a way to fix it. The situation is :

  • for every collection we had previously, we now have 2 collections with the same metadata showing in the UI. They have the same foreign id but not the same collection_id.
  • One of them shows "This path doesn't exist" with 0 entities but the other one works fine.
  • The problem is when we tried to upload anything using those foreign id, it goes to the first collection and we get the error : "This path does not exist"

If only we could delete the first ones, I think it would be fixed. I tried doing so using the collection_id with the cli, but I get back the same error "This path does not exist".

I hope that's more clear.

manonromain avatar Sep 18 '25 12:09 manonromain