Unable to update contact(s)

Nextcloud version: 27.0.2
Operating system and version: Alpine 3.18
nginx version: 1.24.0
PHP version: 8.1.22

I have a long list of contacts. For many of them, if I try to edit anything, clicking ‘Save’ results in an error popping up: Unable to update contact and all changes to that contact being lost.

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

This has happend before the last update as well, maybe earlier, I don’t recall.

Steps to replicate:

  1. Open Contact App.
  2. Click on a Contact.
  3. Click ‘Edit’.
  4. Change any detail.
  5. Click ‘Save’.

Note: Does not always reproduce and seems to be contact dependent (some always work, others never).

The output of your Nextcloud log in Admin > Logging:

There is no log entry corresponding to the time of the error (just entries saying CLI cron call has selected job with ID ...).

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

<?php
$CONFIG = array (
  'datadirectory' => '/var/lib/nextcloud/data',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/usr/share/webapps/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/lib/nextcloud/apps',
      'url' => '/apps-appstore',
      'writable' => true,
    ),
  ),
  'updatechecker' => false,
  'check_for_working_htaccess' => false,
  'installed' => true,
  'instanceid' => '[redacted]',
  'passwordsalt' => '[redacted]',
  'secret' => '[redacted]',
  'trusted_domains' =>
  array (
    0 => '[redacted]',
  ),
  'dbtype' => 'mysql',
  'version' => '27.0.2.1',
  'overwrite.cli.url' => '[redacted]',
  'dbname' => '[redacted]',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '[redacted]',
  'dbpassword' => '[redacted]',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
    'dbindex' => 0,
    'password' => '[redacted]',
    'timeout' => 2,
  ),
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'maintenance' => false,
  'loglevel' => 0,
  'app_install_overwrite' =>
  array (
    0 => 'twofactor_totp',
    1 => 'notes',
    2 => 'news',
  ),
  'mail_from_address' => '[redacted]',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '[redacted]',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => '[redacted]',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '[redacted]',
  'mail_smtpport' => '[redacted]',
  'mail_smtpname' => '[redacted]',
  'mail_smtppassword' => '[redacted]',
  'theme' => '',
);

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

/var/log/nginx/error.log:

2023/08/07 00:31:05 [notice] 12651#12651: signal process started
2023/08/07 00:31:09 [notice] 12862#12862: signal process started
2023/08/08 00:31:05 [notice] 2045#2045: signal process started
2023/08/08 00:31:09 [notice] 2265#2265: signal process started
2023/08/09 00:31:05 [notice] 24875#24875: signal process started
2023/08/09 00:31:09 [notice] 25087#25087: signal process started
2023/08/09 00:31:17 [notice] 27758#27758: signal process started
2023/08/09 00:31:21 [notice] 27972#27972: signal process started
2023/08/10 00:31:06 [notice] 13901#13901: signal process started
2023/08/10 00:31:10 [notice] 14113#14113: signal process started
2023/08/10 00:31:16 [notice] 16784#16784: signal process started
2023/08/10 00:31:20 [notice] 16996#16996: signal process started

No related entires in /var/log/messages.

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

This appears to be the corresponding entry in /var/log/nextcloud/nextcloud.log:

"exception":{"Exception":"RuntimeException","Message":"Unable to open \"/tmp/479ec
a42bf0dd1758c7c2ec315833db3\" using mode \"w+\": fopen(/tmp/479eca42bf0dd1758c7c2ec315833db3): Failed to open stream: Permission denied","Code":0,"Trace":[{"function":"GuzzleHttp\
\Psr7\\{closure}","class":"GuzzleHttp\\Psr7\\Utils","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/psr7/sr
c/Utils.php","line":369,"function":"fopen"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/psr7/src/LazyOpenStream.php","line":47,"function":"tryFopen","class":"GuzzleH
ttp\\Psr7\\Utils","type":"::"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/psr7/src/StreamDecoratorTrait.php","line":33,"function":"createStream","class":"GuzzleHttp
\\Psr7\\LazyOpenStream","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/psr7/src/StreamDecoratorTrait.php",
"line":123,"function":"__get","class":"GuzzleHttp\\Psr7\\LazyOpenStream","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php"
,"line":118,"function":"isSeekable","class":"GuzzleHttp\\Psr7\\LazyOpenStream","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandle
r.php","line":47,"function":"finish","class":"GuzzleHttp\\Handler\\CurlFactory","type":"::"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/Proxy.php
","line":28,"function":"__invoke","class":"GuzzleHttp\\Handler\\CurlHandler","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/Proxy.php","
line":48,"function":"GuzzleHttp\\Handler\\{closure}","class":"GuzzleHttp\\Handler\\Proxy","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps
/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php","line":35,"function":"GuzzleHttp\\Handler\\{closure}","class":"GuzzleHttp\\Handler\\Proxy","type":"::","args":
["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":31,"function":"__invoke","class":"GuzzleHttp
\\PrepareBodyMiddleware","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php","line":71,"function":"GuzzleHttp\\{closure}","cl
ass":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php","l
ine":63,"function":"__invoke","class":"GuzzleHttp\\RedirectMiddleware","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php","line":7
5,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/3rdparty/
guzzlehttp/guzzle/src/Client.php","line":331,"function":"__invoke","class":"GuzzleHttp\\HandlerStack","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle
/src/Client.php","line":168,"function":"transfer","class":"GuzzleHttp\\Client","type":"->"},{"file":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php","line"
:187,"function":"requestAsync","class":"GuzzleHttp\\Client","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/lib/nextcloud/apps/news/lib/Fetcher/FeedFet
cher.php","line":412,"function":"request","class":"GuzzleHttp\\Client","type":"->"},{"file":"/var/lib/nextcloud/apps/news/lib/Fetcher/FeedFetcher.php","line":482,"function":"getFa
vicon","class":"OCA\\News\\Fetcher\\FeedFetcher","type":"->"},{"file":"/var/lib/nextcloud/apps/news/lib/Fetcher/FeedFetcher.php","line":136,"function":"buildFeed","class":"OCA\\Ne
ws\\Fetcher\\FeedFetcher","type":"->"},{"file":"/var/lib/nextcloud/apps/news/lib/Service/FeedServiceV2.php","line":284,"function":"fetch","class":"OCA\\News\\Fetcher\\FeedFetcher"
,"type":"->"},{"file":"/var/lib/nextcloud/apps/news/lib/Service/FeedServiceV2.php","line":364,"function":"fetch","class":"OCA\\News\\Service\\FeedServiceV2","type":"->"},{"file":"
/var/lib/nextcloud/apps/news/lib/Service/UpdaterService.php","line":55,"function":"fetchAll","class":"OCA\\News\\Service\\FeedServiceV2","type":"->"},{"file":"/var/lib/nextcloud/a
pps/news/lib/Cron/UpdaterJob.php","line":74,"function":"update","class":"OCA\\News\\Service\\UpdaterService","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":
"/usr/share/webapps/nextcloud/lib/public/BackgroundJob/Job.php","line":86,"function":"run","class":"OCA\\News\\Cron\\UpdaterJob","type":"->"},{"file":"/usr/share/webapps/nextcloud
/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/public/BackgroundJob
/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/usr/share/webapps/nextcloud/cron.php","line":152,"function":"execute","cl
ass":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/usr/share/webapps/nextcloud/3rdparty/guzzlehttp/psr7/src/Utils.php","Line":357,"message":"Error while running background
 job (class: OCA\\News\\Cron\\UpdaterJob, arguments: )"

Sounds a bit like this.

Does using a different browser help by chance?

May want to add your details/experience to that linked Issue.

Thank you for your reply.

I don’t think the issue you linked looks like what I am experiencing: It is mostly about the save button being inactive which is not the case for me. Just the very last comment there mentions the error message I am getting but that one looks like an unrelated issue posting on the wrong issue to me. Besides the error, they do not provide any additional information that could be useful for me or anyone trying to reproduce this.

I just tried with a different browser and I can reproduce the exact same issue.

I’ll link to this post on github anyway as per your suggestion just in case.

This may be completely unrelated, but it is a serious issue. (You’ll even get a warning about it if you to your Admin page in NC generally).

Something is very not right with your /tmp directory. That’ll create a lot of weird problems across various apps and file transfers.

Thank your for you feedback. I agree this is problematic but don’t know what is causing it: Those files are owned by my nextcloud user and have -rw-r--r-- permissions. Maybe they need to be writable by the entire www-data group so that my nginx user can write to them as well? I can try once I can reproduce this again. For now, I deleted those files and it did not affect my contact saving issue. So probably you were also right about it being unrelated. I’ll check the logs once more to see if there is anything else that could be related.

edit: A bunch of new files was created in /tmp changing those to -rw-rw-r-- via

find /tmp -maxdepth 1 -user nextcloud -exec sudo chmod g+w "{}" \+

Did not solve the contact issue either.