Repository navigation
Description
Which version of recognize are you using?
13.1.0, with recognize_backend 1.0.6 (CUDA)
Enabled Modes
Face recognition, Object recognition
TensorFlow mode
WASM mode
Downstream App
Memories App
Which Nextcloud version do you have installed?
35.0.2 (AIO)
Which Operating system do you have installed?
Debian 12 (LXC container on Proxmox VE); Nextcloud itself runs in the AIO containers
Which database are you running Nextcloud on?
PostgreSQL 18.6 (AIO)
Which Docker container are you using to run Nextcloud? (if applicable)
Nextcloud AIO v14.4.1
How much RAM does your server have?
4 GiB (container limit)
What processor Architecture does your CPU have?
x86_64
Describe the Bug
After switching to TaskProcessing mode with recognize_backend, nothing reached the backend. The queues filled up (about 21,700 files each for faces and imagenet), but no task was ever created, and every cron run logged the same pair of errors for both models. All the photos are in one group folder with Advanced Permissions. I asked Claude Code to trace it, and this is what it found:
ClassifierJob sets up the filesystem for whichever user getMountsForStorageId() returns first (ClassifierJob.php#L70-L75), and AbstractTaskProcessingClassifier::findUserForStorage() makes that same first user the task's user (AbstractTaskProcessingClassifier.php#L91-L100). There's no ORDER BY on that query, so on a group folder the user is whoever the database returns first. Here that is a user from a guest group, who isn't even among the mount users of the file below.
IManager::scheduleTask() then checks every input file. prepareTask() calls validateFileId(), which looks the file up through the root folder (Manager.php#L1896-L1898). Root::getByIdInPath() only searches group folder mounts that are already set up in the process, and each of those is filtered by its own user's ACL (Root.php#L402). So whether a file "exists" depends on which users the cron process happens to have set up. If none of them can read it, the file isn't found and the whole batch of up to 500 files is rejected. The files stay at the head of the queue, so the next run fails on the same batch, forever.
I checked this on one of the failing files, which 13 users have a mount for, setting up one user per fresh process and then calling getFirstNodeById(): it finds the file for the 3 admins and returns NULL for the other 10. Set up one of those 10 and an admin in the same process and it's found again.
The task user hits a second check after that: validateUserAccessToFile() requires the task's user to be among getMountsForFileId() for every file. The first user for the storage wasn't in that list for the file above, so I expect the same batch to fail there once the lookup is fixed.
As a local workaround I changed both call sites to prefer a mount that belongs to an admin and fall back to the first mount otherwise. With that, tasks are scheduled under the admin user, the backend picks them up, and faces and tags start landing. It works here because every admin can read the whole folder.
Possible fixes:
- Pick the task user per batch from users who can actually read every file in it, or split the batch by readable user. Admins happen to work on my instance, but an instance can have a group folder no admin is a member of.
- Don't let one unreadable file block the batch: on a
ValidationExceptionorUnauthorizedException, drop or skip that file and schedule the rest, instead of leaving all 500 queued. - On the server side,
validateFileId()could resolve the file in the task user's folder rather than the root folder. That's a nextcloud/server change, but it would make the result stop depending on process state.
Expected Behavior
Files in a group folder with Advanced Permissions get classified, and a file the chosen user can't read doesn't stop the rest of the batch.
To Reproduce
- Put photos in a group folder with Advanced Permissions, shared with several groups. Deny Read on a subfolder to most of them.
- Install recognize_backend so Recognize runs in TaskProcessing mode, and enable face or object recognition.
- Run a recrawl and let cron run.
- Every run logs the errors below and
oc_taskprocessing_tasksstays empty forapp_id = 'recognize'. Whether it fails depends on which users the cron process has set up, so it fails reliably once most users with a mount are denied the subfolder.
Debug log
Failed to schedule recognize:image:classification task
Temporary problem with imagenet classifier, trying again soon
Failed to schedule recognize:image:facerecognition task
Temporary problem with faces classifier, trying again soon
The previous exception on each:
OCP\TaskProcessing\Exception\ValidationException: Could not find file 10427
lib/private/TaskProcessing/Manager.php:1753
lib/private/TaskProcessing/Manager.php:1086
custom_apps/recognize/lib/Classifiers/AbstractTaskProcessingClassifier.php:74
custom_apps/recognize/lib/BackgroundJobs/ClassifyImagenetJob.php:46
custom_apps/recognize/lib/BackgroundJobs/ClassifierJob.php:79
Activity
marcelklehr commentedon Oct 28, 2026
Hi @AkshayRao27
Thank you for taking the time to give feedback by opening this issue!
Indeed advanced permissions in group folders are an open question with recognize, still. We will think about this.
AkshayRao27 commentedon Oct 28, 2026
Thanks! If there's anything I can do / any way I can contribute, please let me know. I've been doing a bunch of stuff with Nextcloud in the past few months :)
AkshayRao27 commentedon Nov 27, 2026
A follow-up, and a second problem with the same root: Recognize counts everyone who has the group folder mounted as having access to a file, and the mount cache doesn't know about Advanced Permissions.
Since the original report I've been running a local fix for the scheduling part (each file goes to a mount user who can read it), so the backend now gets every photo. Once the face crawl had finished, I asked Claude Code to check who ended up with the detections. Here's what it found:
Who gets the faces. When a face task finishes,
TaskResultListenerstores a copy of every detection for each usergetUsersWithFileAccess()returns (TaskResultListener.php#L220, #L293-L305). That list is everyone with a mount for the file, whether the ACL lets them read it or not. The CPU path builds the same list inClusteringFaceClassifier(#L56-L63), and so doesFsActionService::syncDetectionsForFile()(#L192-L212), which runs on everyUserMountAddedEventandUserMountRemovedEvent(FileListener.php#L51-L59) and copies the detections to every mount user. The local fix doesn't touch any of these files.How much. Nextcloud 35.0.3, Recognize 13.2.1, groupfolders 23.0.2, one group folder with Advanced Permissions, 40 accounts holding face data. Every account and photo with detections was checked against the group folder ACL. Where the ACL said no, the file was also looked up in the account's own folder, so access through a share would still count:
On average, a photo's faces are held by 40 accounts, and about 7 of them can open it.
What a restricted user sees. A test account that can see only part of the folder gets 233 people in the Photos People view. 213 of them have no photos.
FacesHome::getChildren()lists every cluster that has any detections (FacesHome.php#L98-L104), whileFaceRootonly lists the photos the user can open (FaceRoot.php#L94). The cover comes fromfindDetectionForPreviewImageByClusterId(), which doesn't check access either (FaceDetectionMapper.php#L376-L388), so it often points at a photo the user can't open, and the preview endpoint answers 404. That was the case for all 20 covers sampled from the empty clusters, and for 17 of 20 from the account's real ones, which therefore show up blank.No image or name gets through. What the user can learn is how many people appear in photos they're not allowed to see, plus a file id and a face box for each. The rows also take about 5.3 GiB of the 6.6 GiB table here, and face clustering runs for each user over all of them.
A possible fix. If the three
getUsersWithFileAccess()helpers returned only the mount users who can read the file (for examplegetUserFolder($uid)->getFirstNodeById($fileId) !== null, the checkFaceRootalready uses), the existing prune insyncDetectionsForFile()(removeDetectionsForFileFromUsersNotInList(), #L212) would also clear out the rows that are already there. If #1588 goes ahead, the same check could decide who gets a row in the per-user table.Separately, an account that has since been deleted still holds 20,945 detection rows. Nothing in Recognize seems to listen for user deletion: a search of the app for
UserDeletedEventcame up empty.🤖 Generated with Claude Code