Error uploading a video after migration to 4.3.0

Hi,

I recently upgraded my Peertube docker instance from 4.0.0 to 4.3.0, and an user reported he can’t upload a video anymore. Here is the corresponding anonymized log excerpt :

[peertube.example.com:443] 2022-10-11 13:45:41.972 warn: Cannot execute  with many retries. {
  "err": {
    "stack": "Error\n    at Query.run (/app/node_modules/sequelize/lib/dialects/postgres/query.js:50:25)\n    at /app/node_modules/sequelize/lib/sequelize.js:311:28\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async PostgresQueryInterface.insert (/app/node_modules/sequelize/lib/dialects/abstract/query-interface.js:308:21)\n    at async ActorImageModel.save (/app/node_modules/sequelize/lib/model.js:2432:35)\n    at async Function.create (/app/node_modules/sequelize/lib/model.js:1344:12)",
    "message": "Validation error",
    "name": "SequelizeUniqueConstraintError",
    "errors": [
      {
        "message": "actorId must be unique",
        "type": "unique violation",
        "path": "actorId",
        "value": "15",
        "origin": "DB",
        "instance": {
          "id": null,
          "filename": "2ca1a935-c516-4658-9f67-c1ee686d68af.jpg",
          "onDisk": true,
          "fileUrl": null,
          "height": 317,
          "width": 1920,
          "type": 2,
          "actorId": 15,
          "updatedAt": "2022-10-11T13:45:41.649Z",
          "createdAt": "2022-10-11T13:45:41.649Z"
        },
        "validatorKey": "not_unique",
        "validatorName": null,
        "validatorArgs": []
      },
      {
        "message": "type must be unique",
        "type": "unique violation",
        "path": "type",
        "value": "2",
        "origin": "DB",
        "instance": {
          "id": null,
          "filename": "2ca1a935-c516-4658-9f67-c1ee686d68af.jpg",
          "onDisk": true,
          "fileUrl": null,
          "height": 317,
          "width": 1920,
          "type": 2,
          "actorId": 15,
          "updatedAt": "2022-10-11T13:45:41.649Z",
          "createdAt": "2022-10-11T13:45:41.649Z"
        },
        "validatorKey": "not_unique",
        "validatorName": null,
        "validatorArgs": []
      },
      {
        "message": "width must be unique",
        "type": "unique violation",
        "path": "width",
        "value": "1920",
        "origin": "DB",
        "instance": {
          "id": null,
          "filename": "2ca1a935-c516-4658-9f67-c1ee686d68af.jpg",
          "onDisk": true,
          "fileUrl": null,
          "height": 317,
          "width": 1920,
          "type": 2,
          "actorId": 15,
          "updatedAt": "2022-10-11T13:45:41.649Z",
          "createdAt": "2022-10-11T13:45:41.649Z"
        },
        "validatorKey": "not_unique",
        "validatorName": null,
        "validatorArgs": []
      }
    ],
    "parent": {
      "stack": "error: duplicate key value violates unique constraint \"actor_image_actor_id_type_width\"\n    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)\n    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)\n    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)\n    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)\n    at Socket.emit (node:events:513:28)\n    at addChunk (node:internal/streams/readable:315:12)\n    at readableAddChunk (node:internal/streams/readable:289:9)\n    at Socket.Readable.push (node:internal/streams/readable:228:10)\n    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)",
      "message": "duplicate key value violates unique constraint \"actor_image_actor_id_type_width\"",
      "length": 257,
      "name": "error",
      "severity": "ERROR",
      "code": "23505",
      "detail": "Key (\"actorId\", type, width)=(15, 2, 1920) already exists.",
      "schema": "public",
      "table": "actorImage",
      "constraint": "actor_image_actor_id_type_width",
      "file": "nbtinsert.c",
      "line": "663",
      "routine": "_bt_check_unique",
      "sql": "INSERT INTO \"actorImage\" (\"id\",\"filename\",\"height\",\"width\",\"fileUrl\",\"onDisk\",\"type\",\"actorId\",\"createdAt\",\"updatedAt\") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING \"id\",\"filename\",\"height\",\"width\",\"fileUrl\",\"onDisk\",\"type\",\"actorId\",\"createdAt\",\"updatedAt\";",
      "parameters": [
        "2ca1a935-c516-4658-9f67-c1ee686d68af.jpg",
        317,
        1920,
        null,
        true,
        2,
        15,
        "2022-10-11 13:45:41.649 +00:00",
        "2022-10-11 13:45:41.649 +00:00"
      ]
    },
    "original": {
      "stack": "error: duplicate key value violates unique constraint \"actor_image_actor_id_type_width\"\n    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)\n    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)\n    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)\n    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)\n    at Socket.emit (node:events:513:28)\n    at addChunk (node:internal/streams/readable:315:12)\n    at readableAddChunk (node:internal/streams/readable:289:9)\n    at Socket.Readable.push (node:internal/streams/readable:228:10)\n    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)",
      "message": "duplicate key value violates unique constraint \"actor_image_actor_id_type_width\"",
      "length": 257,
      "name": "error",
      "severity": "ERROR",
      "code": "23505",
      "detail": "Key (\"actorId\", type, width)=(15, 2, 1920) already exists.",
      "schema": "public",
      "table": "actorImage",
      "constraint": "actor_image_actor_id_type_width",
      "file": "nbtinsert.c",
      "line": "663",
      "routine": "_bt_check_unique",
      "sql": "INSERT INTO \"actorImage\" (\"id\",\"filename\",\"height\",\"width\",\"fileUrl\",\"onDisk\",\"type\",\"actorId\",\"createdAt\",\"updatedAt\") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING \"id\",\"filename\",\"height\",\"width\",\"fileUrl\",\"onDisk\",\"type\",\"actorId\",\"createdAt\",\"updatedAt\";"
    },
    "fields": {
      "actorId": "15",
      "type": "2",
      "width": "1920"
    },
    "sql": "INSERT INTO \"actorImage\" (\"id\",\"filename\",\"height\",\"width\",\"fileUrl\",\"onDisk\",\"type\",\"actorId\",\"createdAt\",\"updatedAt\") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING \"id\",\"filename\",\"height\",\"width\",\"fileUrl\",\"onDisk\",\"type\",\"actorId\",\"createdAt\",\"updatedAt\";"
  }
}
[peertube.example.com:443] 2022-10-11 13:45:41.986 error: Error in controller. {
  "err": "Error\n    at Query.run (/app/node_modules/sequelize/lib/dialects/postgres/query.js:50:25)\n    at /app/node_modules/sequelize/lib/sequelize.js:311:28\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async PostgresQueryInterface.insert (/app/node_modules/sequelize/lib/dialects/abstract/query-interface.js:308:21)\n    at async ActorImageModel.save (/app/node_modules/sequelize/lib/model.js:2432:35)\n    at async Function.create (/app/node_modules/sequelize/lib/model.js:1344:12)"
} - INSERT INTO "actorImage" ("id","filename","height","width","fileUrl","onDisk","type","actorId","createdAt","updatedAt") VALUES (DEFAULT,$1,$2,$3,$4,$5,$6,$7,$8,$9) RETURNING "id","filename","height","width","fileUrl","onDisk","type","actorId","createdAt","updatedAt";
[peertube.example.com:443] 2022-10-11 13:45:42.001 info: 172.18.0.1 - - [11/Oct/2022:13:45:41 +0000] "POST /api/v1/video-channels/myuser_channel/banner/pick HTTP/1.1" 500 218 "https://peertube.example.com/manage/update/myuser_channel" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.117"
[peertube.example.com:443] 2022-10-11 13:45:42.048 error: Client log: Backend returned code 500, errorMessage is: Validation error {
  "username": "myuser",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.117",
  "url": "https://peertube.example.com/manage/update/myuser_channel"
}
[peertube.example.com:443] 2022-10-11 13:45:42.056 info: 172.18.0.1 - - [11/Oct/2022:13:45:42 +0000] "POST /api/v1/server/logs/client HTTP/1.1" 204 - "https://peertube.example.com/manage/update/myuser_channel" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.117"
[peertube.example.com:443] 2022-10-11 13:45:42.094 error: Client log: Le t<C3><A9>l<C3><A9>versement a <C3><A9>chou<C3><A9>: Le serveur a rencontr<C3><A9> une erreur {
  "username": "myuser",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36 OPR/90.0.4480.117",
  "url": "https://peertube.example.com/manage/update/myuser_channel"
}

Does it ring any bell?

OK my fault. These errors are not related to the upload. And I should have read the changelog.

It works now after updating the nginx configuration after the new template.