Skip to content

Delete fails when working with SMB network mount #370

@genu

Description

@genu

When triggering a delete from youtarr, and the file is on a network SMB mount, the operation will fail with:

[2025-12-15 15:31:14.696 +0000] ERROR: Failed to delete directory {"videoId":54,"videoDirectory":"/usr/src/app/data/PATH"}
    err: {
      "type": "Error",
      "message": "ENOTEMPTY: directory not empty, rmdir '/usr/src/app/data/PATH",
      "stack":
          Error: ENOTEMPTY: directory not empty, rmdir '/usr/src/app/data/EPATH'
      "errno": -39,
      "code": "ENOTEMPTY",
      "syscall": "rmdir",
      "path": "/usr/src/app/data/PATH"
    }

From some investigation, SMB (mac) creates temporary files when deleting over the network share like so:

Image

So, even though the video file is deleted, the operation files when trying to delete the containing folder.

Issue might also be happening because of a race condition the SMB/network share. fs.rm might be correct, but the temp files might be added after the fact by SMB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions