Skip to content

IntegrityError during CreateIIIFURL calls by a Socface script

Sentry Issue: ARKINDEX-BACKEND-1SB

UniqueViolation: duplicate key value violates unique constraint "images_image_server_id_path_06958961_uniq"
DETAIL:  Key (server_id, path)=(232, frad092%2FNeuilly-sur-Seine%2F1D_NUM_NEU_1921_1%2FFRAD092_1MI162_0161_P.JPG) already exists.

  File "django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)

IntegrityError: duplicate key value violates unique constraint "images_image_server_id_path_06958961_uniq"
DETAIL:  Key (server_id, path)=(232, frad092%2FNeuilly-sur-Seine%2F1D_NUM_NEU_1921_1%2FFRAD092_1MI162_0161_P.JPG) already exists.

(23 additional frame(s) were not displayed)
...
  File "django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)

This is in prod, but this doesn't look like it could be a stale read because CreateIIIFURL already has a whole bunch of .using('default') everywhere. I checked locally with a manage.py runserver_plus --print-sql and my local config set to make Django use the same database as a replica, and found that all queries for images and image servers on this endpoint go to default.

It sounds like it might be this line that makes the calls that are getting these errors, but since I don't know anything about Socface I'm just guessing.

The URL is not getting renamed weirdly as described in #148, and #1425 is not occurring at all on the relevant ImageServer.

Edited by Erwan Rouchet