Issues with deleting, moving, and renaming files - External storage

Background:
The Nextcloud package is installed, using an archive file, on a shared hosting server with some folders connected to external storage.
Nextcloud version: 18.0.4, 18.0.6 => 18.0.7
Operating system and version: Ubuntu 18.04
Apache or nginx version: Apache 2.4.29
PHP version: 7.4.3

The issue you are facing:

Could not delete and/or move certain folders contained within a directory synced to external storage; deleting certain files within some folders produces an error essentially identical to the one provided by the OP, except that both of my reported errors also occurs with the default theme, and except for the obvious differences in the name of the folder (and of the file). The issue persists whether an attempted deletion is performed by using the overflow menu, i.e. the three dots between the share icon and the size column in the default (detail) view, is opened or whether a certain file/folder is selected and “Delete” is selected from the ‘Action’ drop-down menu. The

The output of your Nextcloud log in Admin > Logging:

[similar to the one provided by the OP; WILL PASTE HERE UPON REQUEST]

However, in many instances, when selecting a number of files for deletion or when deleting all files using the checkbox next to the title bar resulted in an error message essentially identical to the ones described with at best only one (or several) files deleted.

Is this the first time you’ve seen this error? Y

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

<?php
$CONFIG = array (
  'instanceid' => 'ocnssr8i2s5s',
  'passwordsalt' => 'unsalted',
  'secret' => 'notso',
  'trusted_domains' =>
  array (
    0 => 'domain.tld',
  ),
  'datadirectory' => '/home/ssh-user/domain.tld/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.7.1',
  'overwrite.cli.url' => 'https://domain.tld/nextcloud',
  'dbname' => 'honeysuckle_squirt',
  'dbhost' => 'mysql.server.sticky-hosting.com',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'meee',
  'dbpassword' => 'pass12345',
  'installed' => true,
  'maintenance' => false,
);

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

PASTE HERE

Further information:

Attempting to rename certain folders contained within a directory synced to external storage generates the error message:

Could not rename "[folder name]"

The output of your Nextcloud log in Admin > Logging:

Fatal webdav Error – OCP\Lock\LockedException: "[folder name]" is locked

Resolution:
Although running the occ command occ files:scan [username] per Emi, did not resolve the issue; however, following some of the advice provided by the first post of the topic, File is locked - how to unlock, by @tflidd allowed me to rename the folders in question, two separate times:

  1. place Nextcloud in maintenance mode, per the Admin manual
  2. backup the database, or at least export the table oc_files_locks, before emptying all entries under this table
  3. disable maintenance mode
  4. confirm that background jobs could be run regularly

This operation generates a chain of errors, listed in chronological order, in Admin > Logging:

[160+ PHP Errors] – Trying to access array offset on value of type null at /home/ssh-user/domain.tld/nextcloud/3rdparty/leafo/scssphp/src/Compiler.php#5230
[16 PHP Errors] – Trying to access array offset on value of type null at /home/ssh-user/domain.tld/nextcloud/3rdparty/aws/aws-sdk-php/src/RetryMiddleware.php#144
PHP Error – fopen(https://datacenter.hostname.io/bucket-name/newfoldername): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found at /home/ssh-user/domain.tld/nextcloud/lib/private/Files/ObjectStore/S3ObjectTrait.php#74
PHP Error – fopen(httpseek://): failed to open stream: &quot;OC\Files\Stream\SeekableHttpStream::stream_open&quot; call failed at /home/ssh-user/domain.tld/nextcloud/lib/private/Files/Stream/SeekableHttpStream.php#65
PHP Error – fread() expects parameter 1 to be resource, bool given at /home/ssh-user/domain.tld/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php#861
PHP Error – fclose() expects parameter 1 to be resource, bool given at /home/ssh-user/domain.tld/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php#862

Replicated the steps — The procedure did not appear to affect the contents of the renamed folder, although it repopulates some of the entries within the table oc_files_locks; it is followed by a few more of these errors within the time frame of the login session and a handful more of the same errors upon login and file browsing as the user who changed the folder name:

[PHP Errors] – Trying to access array offset on value of type null at /home/ssh-user/domain.tld/nextcloud/3rdparty/aws/aws-sdk-php/src/RetryMiddleware.php#144

To @Ntouchable and anyone who knows a more reasonable approach to resolving the issue, please contribute to the knowledge of the community with a response.