Cannot re-share folders after renaming them

Nextcloud version (eg, 18.0.2): 20.0.4
PHP version (eg, 7.1): 7.0 (think)

The issue you are facing:
I have a problem sharing folders with another user.
The folders still have been shared with this user but been renamed recently.

Whenever I try to re-create the share, I got an error on the UI.
A look at browsers dev tools show me the cause:

"An exception occurred while executing 'INSERT INTO `notifications` (`app`, `user`, `timestamp`, `object_type`, `object_id`, `subject`, `subject_parameters`, `message`, `message_parameters`, `link`, `icon`, `actions`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [\"files_sharing\", \"<username>\", 1610186167, \"share\", \"ocinternal:42\", \"incoming_user_share\", \"[]\", \"\", \"[]\", \"\", \"\", \"[]\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'"

The interface tell me that the share is established successfully but the other user is not able to see the shared folders.

I tried to delete all entries from notifications table but for every share I create the application will insert an entry with id 0 to this table.

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it:

  1. click share-icon on folder
  2. select the user I want to share with

The output of your Nextcloud log in Admin > Logging:

Think this might be a relevant entry…

{"reqId":"X-l-mv1ePy04LQDLTROFRQAAAQA","level":1,"time":"2021-01-09T10:04:10+00:00","remoteAddr":"94.219.80.41","user":"myusername","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares","message":"Deprecated event type for OCP\\Share::postShare: Symfony\\Component\\EventDispatcher\\GenericEvent is used","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.107 Safari/537.36","version":"20.0.4.0","id":"5ff98416d9de4"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'my-instance-id',
  'passwordsalt' => 'salty',
  'secret' => 'my-secret',
  'trusted_domains' => 
  array (
    0 => 'url-of-my-nc',
  ),
  'datadirectory' => 'path-to-my-nc/data',
  'overwrite.cli.url' => 'url-of-my-nc',
  'dbtype' => 'mysql',
  'version' => '20.0.4.0',
  'dbname' => 'my-db-name',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'my-db-table-prefix',
  'mysql.utf8mb4' => true,
  'dbuser' => 'my-db-user',
  'dbpassword' => 'my-db-password',
  'installed' => true,
  'tempdirectory' => 'path-to-my-nc/tmp/',
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_domain' => 'my-domain',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpsecure' => 'ssl',
  'app_install_overwrite' => 
  array (
    0 => 'calendar',
  ),
  'mail_sendmailmode' => 'smtp',
  'mail_smtphost' => 'smtp-server-address',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
);

The nextcloud instance is running on a shared webserver from all-inkl.com - if this might be from interest…

Appreciate any help! :slight_smile:

What is strange, you don’t put the id=0 in your query. And normally the notification_id is auto-incremented…
You have the occ-command repair that checks the database:
https://docs.nextcloud.com/server/20/admin_manual/configuration_server/occ_command.html#maintenance-commands

Thanks for your reply, @tflidd. In fact I did not put anything in the query because there is no code written by myself within this NC.
I’ve already tried the occ repair command - without success.

Right now everything is working again without any change in the configuration.
What I did: share a folder that’s not been shared before. Voilá, everything fine now! Super strange!