Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCP\Files\NotPermittedException Could not create folder #289

Open
st3iny opened this issue Feb 7, 2022 · 34 comments · Fixed by nextcloud/server#32315
Open

OCP\Files\NotPermittedException Could not create folder #289

st3iny opened this issue Feb 7, 2022 · 34 comments · Fixed by nextcloud/server#32315

Comments

@st3iny
Copy link
Member

st3iny commented Feb 7, 2022

I had a similar issue with Nextcloud 22.2.4:

2022-02-06T10:01:50+00:00 In Folder.php line 173:
2022-02-06T10:01:50+00:00                                         
2022-02-06T10:01:50+00:00   [OCP\Files\NotPermittedException]     
2022-02-06T10:01:50+00:00   Could not create folder: {$fullPath}  
2022-02-06T10:01:50+00:00                                         
2022-02-06T10:01:50+00:00 
2022-02-06T10:01:50+00:00 Exception trace:
2022-02-06T10:01:50+00:00   at /var/www/html/lib/private/Files/Node/Folder.php:173
2022-02-06T10:01:50+00:00  OC\Files\Node\Folder->newFolder() at /var/www/html/lib/private/Files/AppData/AppData.php:156
2022-02-06T10:01:50+00:00  OC\Files\AppData\AppData->newFolder() at /var/www/html/lib/private/Preview/Storage/Root.php:74
2022-02-06T10:01:50+00:00  OC\Preview\Storage\Root->newFolder() at /var/www/html/lib/private/Preview/Generator.php:472
2022-02-06T10:01:50+00:00  OC\Preview\Generator->getPreviewFolder() at /var/www/html/lib/private/Preview/Generator.php:132
2022-02-06T10:01:50+00:00  OC\Preview\Generator->generatePreviews() at /var/www/html/lib/private/PreviewManager.php:204
2022-02-06T10:01:50+00:00  OC\PreviewManager->generatePreviews() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:243
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->parseFile() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:214
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:212
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:212
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:212
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:183
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->generatePathPreviews() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:131
2022-02-06T10:01:50+00:00  OCA\PreviewGenerator\Command\Generate->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255
2022-02-06T10:01:50+00:00  Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009
2022-02-06T10:01:50+00:00  Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273
2022-02-06T10:01:50+00:00  Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149
2022-02-06T10:01:50+00:00  Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:209
2022-02-06T10:01:50+00:00  OC\Console\Application->run() at /var/www/html/console.php:99
2022-02-06T10:01:50+00:00  require_once() at /var/www/html/occ:11

I added a log output in
nextcloud/lib/private/Files/Node/Folder.php:173:
throw new NotPermittedException('Could not create folder, fullPath: '.$fullPath.', path: '.$path);

After i checked and the folder did exist for me. So to fix this i added a check on the creation if the folder already exists to fix this and changed it to:
if (!$this->get($path) || !$this->view->mkdir($fullPath)) { throw new NotPermittedException('Could not create folder, fullPath: '.$fullPath.', path: '.$path); }

Originally posted by @f4t-t0ny in #121 (comment)

@skjnldsv
Copy link
Member

skjnldsv commented Mar 7, 2022

Same issue

@stratege1401
Copy link

Fresh install debian 11.3, apapche 2.4.57, mariaDB 10-5-15, php8.0

Same error, connot create folder:

In Folder.php line 173: 2022-03-31T21:07:14+00:00 2022-03-31T21:07:14+00:00 [OCP\Files\NotPermittedException] 2022-03-31T21:07:14+00:00 Could not create folder 2022-03-31T21:07:14+00:00 2022-03-31T21:07:14+00:00 2022-03-31T21:07:14+00:00 Exception trace: 2022-03-31T21:07:14+00:00 at /var/www/html/lib/private/Files/Node/Folder.php:173 2022-03-31T21:07:14+00:00 OC\Files\Node\Folder->newFolder() at /var/www/html/lib/private/Files/AppData/AppData.php:156 2022-03-31T21:07:14+00:00 OC\Files\AppData\AppData->newFolder() at /var/www/html/lib/private/Preview/Storage/Root.php:74 2022-03-31T21:07:14+00:00 OC\Preview\Storage\Root->newFolder() at /var/www/html/lib/private/Preview/Generator.php:472 2022-03-31T21:07:14+00:00 OC\Preview\Generator->getPreviewFolder() at /var/www/html/lib/private/Preview/Generator.php:132 2022-03-31T21:07:14+00:00 OC\Preview\Generator->generatePreviews() at /var/www/html/lib/private/PreviewManager.php:227 2022-03-31T21:07:14+00:00 OC\PreviewManager->generatePreviews() at /var/www/html/apps/previewgenerator/lib/Command/Generate.php:243 2022-03-31T21:07:14+00:00 OCA\PreviewGenerator\Command\Generate->parseFile() at /var/www/html/apps/previewgenerator/lib/Command/Generate.php:214 2022-03-31T21:07:14+00:00 OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/apps/previewgenerator/lib/Command/Generate.php:212 2022-03-31T21:07:14+00:00 OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/apps/previewgenerator/lib/Command/Generate.php:192 2022-03-31T21:07:14+00:00 OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /var/www/html/apps/previewgenerator/lib/Command/Generate.php:138 2022-03-31T21:07:14+00:00 OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}() at /var/www/html/lib/private/User/Manager.php:656 2022-03-31T21:07:14+00:00 OC\User\Manager->callForSeenUsers() at /var/www/html/apps/previewgenerator/lib/Command/Generate.php:139 2022-03-31T21:07:14+00:00 OCA\PreviewGenerator\Command\Generate->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255 2022-03-31T21:07:14+00:00 Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009 2022-03-31T21:07:14+00:00 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273 2022-03-31T21:07:14+00:00 Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149 2022-03-31T21:07:14+00:00 Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:211 2022-03-31T21:07:14+00:00 OC\Console\Application->run() at /var/www/html/console.php:99 2022-03-31T21:07:14+00:00 require_once() at /var/www/html/occ:11 2022-03-31T21:07:14+00:00 2022-03-31T21:07:14+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...] 2022-03-31T21:07:14+00:00

@stratege1401
Copy link

The idea of letting the process run to end, and logging the errors is nice...

@st3iny
Copy link
Member Author

st3iny commented Apr 13, 2022

@f4t-t0ny @stratege1401 I think I found the problem and developed a patch. The problem is, that I'm not able to reproduce the issue locally. Could you test it for me?

Patch: preview-duplicate-folder-creation.patch.txt

@stratege1401
Copy link

stratege1401 commented Apr 13, 2022 via email

@emptinessboy
Copy link

I meet the same problem

2022-04-27T12:02:26+00:00
2022-04-27T12:02:26+00:00 In Folder.php line 173:
2022-04-27T12:02:26+00:00
2022-04-27T12:02:26+00:00 Could not create folder
2022-04-27T12:02:26+00:00
2022-04-27T12:02:26+00:00
2022-04-27T12:02:26+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2022-04-27T12:02:26+00:00

@emptinessboy
Copy link

@f4t-t0ny @stratege1401我想我发现了问题并开发了一个补丁。问题是,我无法在本地重现该问题。你能帮我测试一下吗?

补丁:preview-duplicate-folder-creation.patch.txt

I tried this patch, it works ok now. I am running Nextcloud23.0 with preview plugin 4.0 on CentOS7,php8.

@MB-Finski
Copy link

@f4t-t0ny @stratege1401 I think I found the problem and developed a patch. The problem is, that I'm not able to reproduce the issue locally. Could you test it for me?

Patch: preview-duplicate-folder-creation.patch.txt

Can confirm, this patch fixed this issue for me.

@st3iny
Copy link
Member Author

st3iny commented May 9, 2022

Thanks a lot for testing the patch. I'll submit it upstream.

@Blisk
Copy link

Blisk commented May 27, 2022

I have the same problem, don't know what this patch is and how it is used?

@st3iny
Copy link
Member Author

st3iny commented May 27, 2022

It is already merged and released. The problem will be fixed if you are using Nextcloud >= 22 and installed the latest update.

@Kh3nsu
Copy link

Kh3nsu commented Jun 12, 2022

Hello I'm currently running Nextcloud 24.0.1.
I got the same error and have installed PreviewGenerator 5.0.0.
I applied the patch but still get this error:

https://pastebin.com/GMxbyMZh

@rhyst
Copy link

rhyst commented Oct 17, 2022

I am using Nextcloud 24.0.6 and 5.0.1 of this app and also get this error when trying to run php occ preview:generate-all. Let me know what logs I could provide to help with this.

@st3iny st3iny reopened this Dec 1, 2022
@Chuckame
Copy link

Chuckame commented Feb 4, 2023

Same for me, nextcloud 25.0.3 (plugin 5.1.1) and 24.0.5 (forgot to take the version) in docker environment

@Chuckame
Copy link

After a full reinstall, i don't have this error anymore

@zvarnes
Copy link

zvarnes commented Mar 27, 2023

I'm running the most recent version of this app, and Nextcloud and still getting this issue...

2023-03-27T01:26:29+00:00 In Folder.php line 166:
2023-03-27T01:26:29+00:00
2023-03-27T01:26:29+00:00 [OCP\Files\NotPermittedException]
2023-03-27T01:26:29+00:00 Could not create folder
2023-03-27T01:26:29+00:00
2023-03-27T01:26:29+00:00
2023-03-27T01:26:29+00:00 Exception trace:
2023-03-27T01:26:29+00:00 at /var/www/nextcloud/lib/private/Files/Node/Folder.php:166
2023-03-27T01:26:29+00:00 OC\Files\Node\Folder->newFolder() at /var/www/nextcloud/lib/private/Files/AppData/AppData.php:147
2023-03-27T01:26:29+00:00 OC\Files\AppData\AppData->newFolder() at /var/www/nextcloud/lib/private/Preview/Storage/Root.php:74
2023-03-27T01:26:29+00:00 OC\Preview\Storage\Root->newFolder() at /var/www/nextcloud/lib/private/Preview/Generator.php:685
2023-03-27T01:26:29+00:00 OC\Preview\Generator->getPreviewFolder() at /var/www/nextcloud/lib/private/Preview/Generator.php:139
2023-03-27T01:26:29+00:00 OC\Preview\Generator->generatePreviews() at /var/www/nextcloud/lib/private/PreviewManager.php:212
2023-03-27T01:26:29+00:00 OC\PreviewManager->generatePreviews() at /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php:199
2023-03-27T01:26:29+00:00 OCA\PreviewGenerator\Command\PreGenerate->processFile() at /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php:177
2023-03-27T01:26:29+00:00 OCA\PreviewGenerator\Command\PreGenerate->processRow() at /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php:145
2023-03-27T01:26:29+00:00 OCA\PreviewGenerator\Command\PreGenerate->startProcessing() at /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php:113
2023-03-27T01:26:29+00:00 OCA\PreviewGenerator\Command\PreGenerate->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:255
2023-03-27T01:26:29+00:00 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:1009
2023-03-27T01:26:29+00:00 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:273
2023-03-27T01:26:29+00:00 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:149
2023-03-27T01:26:29+00:00 Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:215
2023-03-27T01:26:29+00:00 OC\Console\Application->run() at /var/www/nextcloud/console.php:100
2023-03-27T01:26:29+00:00 require_once() at /var/www/nextcloud/occ:11
2023-03-27T01:26:29+00:00
2023-03-27T01:26:29+00:00 preview:pre-generate
2023-03-27T01:26:29+00:00

@st3iny
Copy link
Member Author

st3iny commented Mar 27, 2023

@zvarnes Did you apply said patch manually at some point in the past?

@zvarnes
Copy link

zvarnes commented Mar 27, 2023

@st3iny No I did not.

@ghost
Copy link

ghost commented Mar 28, 2023

Still an issue on NC 26.0.0

{"reqId":"C9cREwf8AoxLPgLYppzf","level":3,"time":"2023-03-27T21:57:43-05:00","remoteAddr":"1.1.1.1","user":"IT","app":"index","method":"GET","url":"/apps/photos/api/v1/preview/978628?etag=bc17f3e333f5a2b73aaa6d7b095162fd&x=512&y=512","message":"Could not create folder","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36","version":"26.0.0.11","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create folder","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Files/AppData/AppData.php","line":147,"function":"newFolder","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Storage/Root.php","line":74,"function":"newFolder","class":"OC\\Files\\AppData\\AppData","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":685,"function":"newFolder","class":"OC\\Preview\\Storage\\Root","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":139,"function":"getPreviewFolder","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":116,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":192,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php","line":162,"function":"getPreview","class":"OC\\PreviewManager","type":"->"},{"file":"/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php","line":128,"function":"fetchPreview","class":"OCA\\Photos\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Photos\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1055,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Files/Node/Folder.php","Line":166,"CustomMessage":"--"},"id":"642350c51ba48"}

@CorneliousJD
Copy link

I just installed this app and am seeing the same issue running
docker exec -u www-data Nextcloud ./occ preview:generate-all -vvv

2023-04-18T18:56:38+00:00 
2023-04-18T18:56:38+00:00 In Folder.php line 166:
2023-04-18T18:56:38+00:00                                      
2023-04-18T18:56:38+00:00   [OCP\Files\NotPermittedException]  
2023-04-18T18:56:38+00:00   Could not create folder            
2023-04-18T18:56:38+00:00                                      
2023-04-18T18:56:38+00:00 
2023-04-18T18:56:38+00:00 Exception trace:
2023-04-18T18:56:38+00:00   at /var/www/html/lib/private/Files/Node/Folder.php:166
2023-04-18T18:56:38+00:00  OC\Files\Node\Folder->newFolder() at /var/www/html/lib/private/Files/AppData/AppData.php:147
2023-04-18T18:56:38+00:00  OC\Files\AppData\AppData->newFolder() at /var/www/html/lib/private/Preview/Storage/Root.php:74
2023-04-18T18:56:38+00:00  OC\Preview\Storage\Root->newFolder() at /var/www/html/lib/private/Preview/Generator.php:685
2023-04-18T18:56:38+00:00  OC\Preview\Generator->getPreviewFolder() at /var/www/html/lib/private/Preview/Generator.php:139
2023-04-18T18:56:38+00:00  OC\Preview\Generator->generatePreviews() at /var/www/html/lib/private/PreviewManager.php:212
2023-04-18T18:56:38+00:00  OC\PreviewManager->generatePreviews() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:230
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->parseFile() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:212
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:210
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:210
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:210
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:190
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:136
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}() at /var/www/html/lib/private/User/Manager.php:639
2023-04-18T18:56:38+00:00  OC\User\Manager->callForSeenUsers() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:137
2023-04-18T18:56:38+00:00  OCA\PreviewGenerator\Command\Generate->execute() at /var/www/html/custom_apps/recognize/vendor/symfony/console/Command/Command.php:298
2023-04-18T18:56:38+00:00  Symfony\Component\Console\Command\Command->run() at /var/www/html/custom_apps/recognize/vendor/symfony/console/Application.php:1040
2023-04-18T18:56:38+00:00  Symfony\Component\Console\Application->doRunCommand() at /var/www/html/custom_apps/recognize/vendor/symfony/console/Application.php:301
2023-04-18T18:56:38+00:00  Symfony\Component\Console\Application->doRun() at /var/www/html/custom_apps/recognize/vendor/symfony/console/Application.php:171
2023-04-18T18:56:38+00:00  Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:215
2023-04-18T18:56:38+00:00  OC\Console\Application->run() at /var/www/html/console.php:100
2023-04-18T18:56:38+00:00  require_once() at /var/www/html/occ:11
2023-04-18T18:56:38+00:00 
2023-04-18T18:56:38+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2023-04-18T18:56:38+00:00 

@krlls
Copy link

krlls commented Apr 25, 2023

Same issue:
NextCloud: 26.0.1 (Docker)
PreviewGenerator: 5.2.4

@CorneliousJD
Copy link

I eventually kept running it over and over and it finished successfully.

@arcoast
Copy link

arcoast commented May 1, 2023

I'm also seeing this on v5.2.4 on Nextcloud v26.0.0

Running occ preview:generate-all -vvv

2023-05-01T17:20:10+00:00 
2023-05-01T17:20:10+00:00 In Folder.php line 166:
2023-05-01T17:20:10+00:00                                      
2023-05-01T17:20:10+00:00   [OCP\Files\NotPermittedException]  
2023-05-01T17:20:10+00:00   Could not create folder            
2023-05-01T17:20:10+00:00                                      
2023-05-01T17:20:10+00:00 
2023-05-01T17:20:10+00:00 Exception trace:
2023-05-01T17:20:10+00:00   at /config/www/nextcloud/lib/private/Files/Node/Folder.php:166
2023-05-01T17:20:10+00:00  OC\Files\Node\Folder->newFolder() at /config/www/nextcloud/lib/private/Files/AppData/AppData.php:147
2023-05-01T17:20:10+00:00  OC\Files\AppData\AppData->newFolder() at /config/www/nextcloud/lib/private/Preview/Storage/Root.php:74
2023-05-01T17:20:10+00:00  OC\Preview\Storage\Root->newFolder() at /config/www/nextcloud/lib/private/Preview/Generator.php:685
2023-05-01T17:20:10+00:00  OC\Preview\Generator->getPreviewFolder() at /config/www/nextcloud/lib/private/Preview/Generator.php:139
2023-05-01T17:20:10+00:00  OC\Preview\Generator->generatePreviews() at /config/www/nextcloud/lib/private/PreviewManager.php:212
2023-05-01T17:20:10+00:00  OC\PreviewManager->generatePreviews() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:230
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->parseFile() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:212
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:190
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:136
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}() at /config/www/nextcloud/lib/private/User/Manager.php:639
2023-05-01T17:20:10+00:00  OC\User\Manager->callForSeenUsers() at /config/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:137
2023-05-01T17:20:10+00:00  OCA\PreviewGenerator\Command\Generate->execute() at /config/www/nextcloud/3rdparty/symfony/console/Command/Command.php:255
2023-05-01T17:20:10+00:00  Symfony\Component\Console\Command\Command->run() at /config/www/nextcloud/3rdparty/symfony/console/Application.php:1009
2023-05-01T17:20:10+00:00  Symfony\Component\Console\Application->doRunCommand() at /config/www/nextcloud/3rdparty/symfony/console/Application.php:273
2023-05-01T17:20:10+00:00  Symfony\Component\Console\Application->doRun() at /config/www/nextcloud/3rdparty/symfony/console/Application.php:149
2023-05-01T17:20:10+00:00  Symfony\Component\Console\Application->run() at /config/www/nextcloud/lib/private/Console/Application.php:215
2023-05-01T17:20:10+00:00  OC\Console\Application->run() at /config/www/nextcloud/console.php:100
2023-05-01T17:20:10+00:00  require_once() at /config/www/nextcloud/occ:11
2023-05-01T17:20:10+00:00 
2023-05-01T17:20:10+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2023-05-01T17:20:10+00:00 

@arcoast
Copy link

arcoast commented May 2, 2023

Just to update, I ran the scan for each user separately and it seems to have done the trick and I can't reproduce the above any longer.

@zvarnes
Copy link

zvarnes commented May 4, 2023

Still getting this error on version 26.0.1

@SchoolGuy
Copy link

I was able to trigger this bug with executing two preview:generate-all in parallel on accident.

NC 26.0.2 and Preview Generator 5.3.0

@zvarnes
Copy link

zvarnes commented Aug 16, 2023

Still getting this error on 27.0.1. Where can I confirm your patch backport was successful? @st3iny

Well apparently it's fixed in 27.0.2 😐

I've done more testing, and I think just rescanning the files would help get ride of the error that was showing up. I ran this on a loop until the error went away. while true; do sudo -u www-data php /var/www/nextcloud/occ files:scan-app-data && sudo -u www-data php /var/www/nextcloud/occ preview:generate-all; done

@maxkratz
Copy link

This issue also occurs on my Nextcloud instance (v25.0.12). Is there any ETA for a fix?

@JOHLC
Copy link

JOHLC commented Nov 22, 2023

I am also seeing this.
Installation: Nextcloud VM
Nextcloud version: 27.1.3
Preview generator version: 5.3.0

It seems to get through 974 files/folders or more before erroring out, and seems to always be on the same folder.
A reinstall of the app didn't resolve it.

sudo -u www-data php /var/www/nextcloud/occ preview:generate-all

[...]

2023-11-22T03:08:01+00:00 Generating previews for /User/files/User/Pictures/Graphics/DC Pictures/GEDC0607.JPG
2023-11-22T03:08:01+00:00 
2023-11-22T03:08:01+00:00 In Folder.php line 162:
2023-11-22T03:08:01+00:00                                                                                 
2023-11-22T03:08:01+00:00   [OCP\Files\NotPermittedException]                                             
2023-11-22T03:08:01+00:00   Could not create folder "/appdata_ockpphbbu4qb/preview/6/9/0/5/c/3/3/867860"  
2023-11-22T03:08:01+00:00                                                                                 
2023-11-22T03:08:01+00:00 
2023-11-22T03:08:01+00:00 Exception trace:
2023-11-22T03:08:01+00:00   at /var/www/nextcloud/lib/private/Files/Node/Folder.php:162
2023-11-22T03:08:01+00:00  OC\Files\Node\Folder->newFolder() at /var/www/nextcloud/lib/private/Files/AppData/AppData.php:147
2023-11-22T03:08:01+00:00  OC\Files\AppData\AppData->newFolder() at /var/www/nextcloud/lib/private/Preview/Storage/Root.php:74
2023-11-22T03:08:01+00:00  OC\Preview\Storage\Root->newFolder() at /var/www/nextcloud/lib/private/Preview/Generator.php:607
2023-11-22T03:08:01+00:00  OC\Preview\Generator->getPreviewFolder() at /var/www/nextcloud/lib/private/Preview/Generator.php:139
2023-11-22T03:08:01+00:00  OC\Preview\Generator->generatePreviews() at /var/www/nextcloud/lib/private/PreviewManager.php:212
2023-11-22T03:08:01+00:00  OC\PreviewManager->generatePreviews() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:230
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->parseFile() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:212
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:210
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:190
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:136
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}() at /var/www/nextcloud/lib/private/User/Manager.php:632
2023-11-22T03:08:01+00:00  OC\User\Manager->callForSeenUsers() at /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php:137
2023-11-22T03:08:01+00:00  OCA\PreviewGenerator\Command\Generate->execute() at /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php:298
2023-11-22T03:08:01+00:00  Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:1040
2023-11-22T03:08:01+00:00  Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:301
2023-11-22T03:08:01+00:00  Symfony\Component\Console\Application->doRun() at /var/www/nextcloud/3rdparty/symfony/console/Application.php:171
2023-11-22T03:08:01+00:00  Symfony\Component\Console\Application->run() at /var/www/nextcloud/lib/private/Console/Application.php:211
2023-11-22T03:08:01+00:00  OC\Console\Application->run() at /var/www/nextcloud/console.php:100
2023-11-22T03:08:01+00:00  require_once() at /var/www/nextcloud/occ:11
2023-11-22T03:08:01+00:00 
2023-11-22T03:08:01+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2023-11-22T03:08:01+00:00 

@njchristoffersen
Copy link

njchristoffersen commented Jan 5, 2024

Installation: Nextcloud AIO via docker*
Version: Nextcloud Hub 6 (27.1.4)
*all commands below have been prepended with docker exec -u 33 -it nextcloud-aio-nextcloud, but I left that out for simplicity

I am seeing the same thing:

In Folder.php line 162:
...
Could not create folder "/appdata_ocmqi08lafyh/preview/6/6/3/f/a/6/5/84785"

My best guess is that this happens when it gets to photos that have already generated previews for (as my process ran for about 120GiB worth of photos without errors, but then when it got to ones that I have accessed before in browser and on my phone, it spit the error).

Steps Attempted:

Scan Files (returns same error in same location)

php occ files:scan --all
php occ preview:generate-all

Scan App Data (same error but later on, so more previews were successfully generated)

php occ files:scan-app-data
php occ preview:generate-all

@Mat-DB
Copy link

Mat-DB commented Jan 19, 2024

I have the same error on NC28.0.1 and the preview generator app just installed and run number 3 I think.

What is the difference between the following?

php occ preview:generate-all
php occ preview:generate --all

@njchristoffersen
Copy link

The first is a correct command, the second is a typo that I made. Thank you for catching that and I've edited my previous comment accordingly.

@joshtrichards joshtrichards changed the title Could not create folder OCP\Files\NotPermittedException Could not create folder Mar 30, 2024
@joshtrichards
Copy link
Member

I think this may be nextcloud/server#36463 which was just fixed in nextcloud/server#41067 (Server v27.1.7 and v28.0.3 have the fix).

@chrisborell
Copy link

Still occuring for me in [Nextcloud Hub 8] (29.0.2)

Screenshot 2024-06-20 at 10 09 39 am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.