Unable to decrypt some files on S3 Storage (Cloudflare R2)

Nextcloud version: 26.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52
PHP version (eg, 7.4): PHP 8.1.2-1ubuntu2.11

The issue you are facing:

I am having trouble decrypting encrypted files in Nextcloud that are stored in Cloudflare R2 storage. I tried decrypting the files using decrypt-all, and I believe I have the keys (although, not certain). It’s weird, because some files are still encrypted and can’t be accessed, whilst others can be viewed and opened perfectly fine.

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

Steps to replicate it:

Honestly, not sure. This happened a while ago on v25, and it frustrated me to the point that I gave up for a few months. From what I remember, I enabled encryption, then faced some issues so disabled it. I backed up the S3 files (in the form of urn:oid:XXXXX) a few months ago, as well as recently.

The output of your Nextcloud log in Admin > Logging:

Error	webdav	Sabre\DAV\Exception\ServiceUnavailable: Could not open file	
2023-05-03T21:12:44+0000
Error	PHP	fopen(httpseek://): Failed to open stream: "OC\Files\Stream\SeekableHttpStream::stream_open" call failed at /var/www/nextcloud/lib/private/Files/Stream/SeekableHttpStream.php#67	
2023-05-03T21:12:44+0000
Error	PHP	fopen(https://[REDACTED].[REDACTED].r2.cloudflarestorage.com/urn%3Aoid%3A113045): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found at /var/www/nextcloud/lib/private/Files/ObjectStore/S3ObjectTrait.php#89	
2023-05-03T21:12:44+0000
Error	webdav	Sabre\DAV\Exception\ServiceUnavailable: Could not open file	
2023-05-03T21:12:44+0000
Error	PHP	fopen(httpseek://): Failed to open stream: "OC\Files\Stream\SeekableHttpStream::stream_open" call failed at /var/www/nextcloud/lib/private/Files/Stream/SeekableHttpStream.php#67	
2023-05-03T21:12:44+0000
Error	PHP	fopen(https://[REDACTED].[REDACTED].r2.cloudflarestorage.com/urn%3Aoid%3A112556): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found at /var/www/nextcloud/lib/private/Files/ObjectStore/S3ObjectTrait.php#89	
2023-05-03T21:12:44+0000

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

<?php
$CONFIG = array (
  'filelocking.enabled' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_from_address' => '[REDACTED]',
  'mail_domain' => '[REDACTED]',
  'mail_smtphost' => '[REDACTED]',
  'mail_smtpport' => '587',
  'mail_smtpname' => '[REDACTED]',
  'mail_smtppassword' => '[REDACTED]',
  'mail_smtpsecure' => 'tls',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '172.18.0.1',
    'port' => 6379,
    'password' => 'wjw.mcd1ewz.pjk9QKD',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'webhooks_secret' => '[REDACTED]',
  'maintenance' => false,
  'objectstore' => 
  array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' => 
    array (
      'bucket' => '[REDACTED]',
      'autocreate' => true,
      'region' => 'auto',
      'key' => '[REDACTED]',
      'secret' => '[REDACTED]',
      'use_ssl' => true,
      'hostname' => '[REDACTED].r2.cloudflarestorage.com',
      'port' => 443,
      'use_path_style' => false,
    ),
  ),
  'instanceid' => '[REDACTED]',
  'passwordsalt' => '[REDACTED]',
  'secret' => '[REDACTED]',
  'trusted_domains' => 
  array (
    0 => '[REDACTED]',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '26.0.1.1',
  'overwrite.cli.url' => '[REDACTED]',
  'dbname' => '[REDACTED]',
  'dbhost' => '[REDACTED]',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '[REDACTED]',
  'dbpassword' => '[REDACTED]',
  'installed' => true,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
    0 => 'admin',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'theme' => '',
  'loglevel' => 2,
  'skeletondirectory' => '',
  'allow_local_remote_servers' => false,
  'appcodechecker' => true,
  'syslog_tag' => 'Nextcloud',
  'syslog_tag_audit' => 'Nextcloud',
  'maintenance_window_start' => 3,
  'diagnostics.logging' => false,
  'profile.enabled' => false,
  'tempdirectory' => '/var/www/nextcloud/data/tmp',
  'app_install_overwrite' => 
  array (
    0 => 'impersonate',
  ),
  'updater.secret' => '[REDACTED]',
);

The output of your Apache/nginx/system log in /var/log/____: N/A (no logs)

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.

Can you still access the storage independently from Nextcloud?
The 404 error is strange, that means the file doesn’t exist any more? If it were only that you can’t access them, it might be a quota setting or something that you are rate-limited. But that should normally trigger temporary errors.

I can still access storage independently from Nextcloud, yes. It’s weird, because with some other text files I had this with, I used version control to get the previous version up. Then, it worked like a charm.

Bumping thread.