Problem Sharing files (NextCloud 16 - Debian 8.11) - Invalid query, please check the syntax. API specifications are here: sharing

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face: is for home/non-enterprise users. If you’re running a business, paid support can be accessed via where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

Or for longer, use three backticks above and below the code snippet:


Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version : 16.0.1
Operating system and version : Debian 8.11
Apache or nginx version : Apache/2.4.10 (Debian)
PHP version : PHP 7.2.14-1+0

The issue you are facing:

 When trying to share a folder or group, I see only a list of 2 users and 1 group I can share with (its more 47 users and15 groups...but those are not displayed) When trying to type in existing username, An error is displayed at the very top: nvalid query, please check the syntax. API specifications are here: sharing 

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

Steps to replicate it:

  1. Upload file
  2. press share button
  3. try typing in a username to share with

The output of your Nextcloud log in Admin > Logging:


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

more config.php
$CONFIG = array (
  'instanceid' => 'i',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '',
    1 => '',
    2 => '',
  'datadirectory' => '/var/www/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin',
  'dbpassword' => 'J',
  'logtimezone' => 'UTC',
  'installed' => true,
  'maintenance' => false,
  'mysql.utf8mb4' => true,
  'theme' => '',
  'loglevel' => 2,
  '' => 'stable',
  'trashbin_retention_obligation' => 1,
  0 => 3,
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_domain' => ',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtphost' =>
  'mail_smtpport' => '25',
  'mail_smtpname' => 
  'app_install_overwrite' => 
  array (
    0 => 'calendar',

The output of your Apache/nginx/system log in /var/log/____:


I went through the update process manually again…
Seems there were a few glitches in the database…
It works again…the error is gone now…

Hello Théo-Tiger
I have this bug with the same pattern : when typing an email or a contact to share the folder/document.
An error occurred ("Invalid query, please check the syntax. API specifications are here: "). Please try again
Do you remember how you did to recover the use of NC ? Was that a brand new install ? Did you upgrade ?

In order to help people that would go through this thread, here’s interesting directions here :

that mentions a setting on the MySQL database :

UPDATE :slight_smile:

These threads are correct : I could correct the trouble with the setting on the MySQL database.