<p>I was able to fix the issue by manually uploading my images to the new S3 location via the AWS console and refreshing my asset indexes.</p>

<p>It seems like it was just getting confused with the old local asset connections. Hopefully it's not indicative of an underlying problem with my setup.</p>

CC BY-SA 4.0
2018-05-10T16:20:43.520Z
2018-05-10T16:20:43.520Z
Andrea Hall
<p>I'm on Craft 3 and I've just switched some of my asset sources to S3. I'm developing on a local instance, and it all seems to be working. However, I needed to reconnect a couple images in my homepage single entry because I changed the path to one of the subfolders.</p>

<p>When I save the entry after selecting the images I want to use from my new S3 volume, I get an error page with the following: </p>

<blockquote>
  <p>fopen({my local root}/craft/storage/runtime/assets/tempuploads/user_1/my-file.jpeg):
  failed to open stream: No such file or directory</p>
</blockquote>

<p>I opened up the tempuploads folder and (as expected) only 2 of the 3 images I wanted to change were in there. Ok. So I manually added the third image, thinking it was a fluke and tried again. </p>

<p>I got the error again, but for a different image. I went back to the folder and only 1 image was in there. </p>

<p>It seems there's something wonky going on with the temp upload process. Has anyone run across this before?</p>

<p>Here's the stack trace:</p>

<pre><code>yii\base\ErrorException: fopen(/Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/storage/runtime/assets/tempuploads/user_1/home-video-still.jpeg): failed to open stream: No such file or directory in /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Adapter/Local.php:181
Stack trace:
#0 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(84): yii\base\ErrorHandler-&gt;handleError(2, 'fopen(/Users/ah...', '/Users/ahall/Pr...', 181)
#1 [internal function]: craft\web\ErrorHandler-&gt;handleError(2, 'fopen(/Users/ah...', '/Users/ahall/Pr...', 181, Array)
#2 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Adapter/Local.php(181): fopen('/Users/ahall/Pr...', 'rb')
#3 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Filesystem.php(196): League\Flysystem\Adapter\Local-&gt;readStream('user_1/home-vid...')
#4 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(173): League\Flysystem\Filesystem-&gt;readStream('user_1/home-vid...')
#5 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(187): craft\base\FlysystemVolume-&gt;getFileStream('user_1/home-vid...')
#6 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Asset.php(1387): craft\base\FlysystemVolume-&gt;saveFileLocally('user_1/home-vid...', '/Users/ahall/Pr...')
#7 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Asset.php(1224): craft\elements\Asset-&gt;_relocateFile()
#8 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\Asset-&gt;afterSave(false)
#9 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Assets.php(187): craft\services\Elements-&gt;saveElement(Object(craft\elements\Asset))
#10 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/fields/Assets.php(402): craft\services\Assets-&gt;moveAsset(Object(craft\elements\Asset), Object(craft\models\VolumeFolder))
#11 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/Element.php(1808): craft\fields\Assets-&gt;afterElementSave(Object(craft\elements\MatrixBlock), false)
#12 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/MatrixBlock.php(395): craft\base\Element-&gt;afterSave(false)
#13 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\MatrixBlock-&gt;afterSave(false)
#14 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Matrix.php(683): craft\services\Elements-&gt;saveElement(Object(craft\elements\MatrixBlock), false, true)
#15 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/fields/Matrix.php(646): craft\services\Matrix-&gt;saveField(Object(craft\fields\Matrix), Object(craft\elements\Entry))
#16 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/Element.php(1808): craft\fields\Matrix-&gt;afterElementSave(Object(craft\elements\Entry), false)
#17 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Entry.php(987): craft\base\Element-&gt;afterSave(false)
#18 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\Entry-&gt;afterSave(false)
#19 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/controllers/EntriesController.php(539): craft\services\Elements-&gt;saveElement(Object(craft\elements\Entry))
#20 [internal function]: craft\controllers\EntriesController-&gt;actionSaveEntry()
#21 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#22 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&gt;runWithParams(Array)
#23 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Controller.php(76): yii\base\Controller-&gt;runAction('save-entry', Array)
#24 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller-&gt;runAction('save-entry', Array)
#25 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module-&gt;runAction('entries/save-en...', Array)
#26 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(522): craft\web\Application-&gt;runAction('entries/save-en...', Array)
#27 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(258): craft\web\Application-&gt;_processActionRequest(Object(craft\web\Request))
#28 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#29 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/web/index.php(21): yii\base\Application-&gt;run()
#30 {main}
</code></pre>

CC BY-SA 4.0
2018-05-08T21:59:37.667Z
Usually when you see that "failed to open stream: No such file or directory" error, some other fatal error has happened during the upload process. i.e. memory limits, execution times, s3 permissions, etc.  Anything useful in Craft's or your web server's error logs?
Brad Bell
CC BY-SA 4.0
2018-05-10T15:51:18.330Z
I update the post with my stack trace. I checked my craft error files but didn't see any entries for the days I was testing it. I don't know how to find my server error logs.

I'm using Imager - thought it could be related to that, but it seems to be doing fine with the S3 buckets I'm using elsewhere. This error seems to be specifically related to me updating an asset using a new path.
Andrea Hall
CC BY-SA 4.0
2018-06-01T23:26:47.750Z
Im in a similar boat. Same error. However, Ive got the bugsnag plugin that should output all errors to bugsnag. I only see this error, no error related to uploading the document. I can try the same document a moment later, and succeed. The problem is intermittent.
kenyabob
<craft3><s3>
Craft 3 error on upload fopen() tempuploads "failed to open stream: No such file or directory"
# Craft 3 error on upload fopen() tempuploads "failed to open stream: No such file or directory"

(Asked by: username_0 on 2018-05-07)

I'm on Craft 3 and I've just switched some of my asset sources to S3. I'm developing on a local instance, and it all seems to be working. However, I needed to reconnect a couple images in my homepage single entry because I changed the path to one of the subfolders.
When I save the entry after selecting the images I want to use from my new S3 volume, I get an error page with the following: 

fopen({my local root}/craft/storage/runtime/assets/tempuploads/user_1/my-file.jpeg):
  failed to open stream: No such file or directory

I opened up the tempuploads folder and (as expected) only 2 of the 3 images I wanted to change were in there. Ok. So I manually added the third image, thinking it was a fluke and tried again. 
I got the error again, but for a different image. I went back to the folder and only 1 image was in there. 
It seems there's something wonky going on with the temp upload process. Has anyone run across this before?
Here's the stack trace:
yii\base\ErrorException: fopen(/Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/storage/runtime/assets/tempuploads/user_1/home-video-still.jpeg): failed to open stream: No such file or directory in /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Adapter/Local.php:181
Stack trace:
#0 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(84): yii\base\ErrorHandler->handleError(2, 'fopen(/Users/ah...', '/Users/ahall/Pr...', 181)
#1 [internal function]: craft\web\ErrorHandler->handleError(2, 'fopen(/Users/ah...', '/Users/ahall/Pr...', 181, Array)
#2 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Adapter/Local.php(181): fopen('/Users/ahall/Pr...', 'rb')
#3 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/league/flysystem/src/Filesystem.php(196): League\Flysystem\Adapter\Local->readStream('user_1/home-vid...')
#4 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(173): League\Flysystem\Filesystem->readStream('user_1/home-vid...')
#5 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/FlysystemVolume.php(187): craft\base\FlysystemVolume->getFileStream('user_1/home-vid...')
#6 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Asset.php(1387): craft\base\FlysystemVolume->saveFileLocally('user_1/home-vid...', '/Users/ahall/Pr...')
#7 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Asset.php(1224): craft\elements\Asset->_relocateFile()
#8 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\Asset->afterSave(false)
#9 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Assets.php(187): craft\services\Elements->saveElement(Object(craft\elements\Asset))
#10 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/fields/Assets.php(402): craft\services\Assets->moveAsset(Object(craft\elements\Asset), Object(craft\models\VolumeFolder))
#11 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/Element.php(1808): craft\fields\Assets->afterElementSave(Object(craft\elements\MatrixBlock), false)
#12 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/MatrixBlock.php(395): craft\base\Element->afterSave(false)
#13 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\MatrixBlock->afterSave(false)
#14 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Matrix.php(683): craft\services\Elements->saveElement(Object(craft\elements\MatrixBlock), false, true)
#15 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/fields/Matrix.php(646): craft\services\Matrix->saveField(Object(craft\fields\Matrix), Object(craft\elements\Entry))
#16 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/base/Element.php(1808): craft\fields\Matrix->afterElementSave(Object(craft\elements\Entry), false)
#17 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/elements/Entry.php(987): craft\base\Element->afterSave(false)
#18 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/services/Elements.php(463): craft\elements\Entry->afterSave(false)
#19 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/controllers/EntriesController.php(539): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#20 [internal function]: craft\controllers\EntriesController->actionSaveEntry()
#21 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#22 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#23 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Controller.php(76): yii\base\Controller->runAction('save-entry', Array)
#24 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry', Array)
#25 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction('entries/save-en...', Array)
#26 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(522): craft\web\Application->runAction('entries/save-en...', Array)
#27 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/craftcms/cms/src/web/Application.php(258): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#28 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#29 /Users/ahall/Projects/Perforce/depot/Websites/SchellGames/2017Update/Website/2.1_Craft3Microsites/craft/web/index.php(21): yii\base\Application->run()
#30 {main}

**Tags:** craft3, s3

> **Comments:**
> **username_1**: Usually when you see that "failed to open stream: No such file or directory" error, some other fatal error has happened during the upload process. i.e. memory limits, execution times, s3 permissions, etc.  Anything useful in Craft's or your web server's error logs?  
> **username_0**: I update the post with my stack trace. I checked my craft error files but didn't see any entries for the days I was testing it. I don't know how to find my server error logs.  I'm using Imager - thought it could be related to that, but it seems to be doing fine with the S3 buckets I'm using elsewhere. This error seems to be specifically related to me updating an asset using a new path.  
> **username_2**: Im in a similar boat. Same error. However, Ive got the bugsnag plugin that should output all errors to bugsnag. I only see this error, no error related to uploading the document. I can try the same document a moment later, and succeed. The problem is intermittent.  

---

## 1 answers

### Answer by username_0 on 2018-05-10. Score: 1

I was able to fix the issue by manually uploading my images to the new S3 location via the AWS console and refreshing my asset indexes.

It seems like it was just getting confused with the old local asset connections. Hopefully it's not indicative of an underlying problem with my setup.


---

