openmediavault/openmediavault · error · OMV\Exception

Cannot unlink the shared folder content because another…

Error message

Cannot unlink the shared folder content because another shared folder also refers to it

What it means

sharemgmt::delete (unlink content path) refuses to delete a shared folder's content when a database filter finds another shared folder pointing at the same reldirpath. openmediavault guards against deleting data still referenced by a second shared folder entry. It is a deliberate safety invariant, not a runtime failure.

Solutions

  1. List shared folders and find the duplicate entry with the same reldirpath (via WebGUI Storage>Shared Folders or omv-confdbadb read conf.system.sharedfolder).
  2. Delete the duplicate/unneeded shared folder entry first (choose 'not delete content'), then delete the remaining one.
  3. If the duplicate references a dead mount, fix or remove the underlying filesystem/mount entry, refresh, and retry.

Example fix

// before: two SFs -> same path, delete fails
# omv-confdbadb read conf.system.sharedfolder | grep reldirpath
// after: remove the duplicate SF entry, then delete
# omv-confdbadb delete conf.system.sharedfolder <dup-uuid>
# then delete the remaining shared folder via RPC/UI
Defensive patterns

Strategy: validation

Validate before calling

const dups = sfs.filter(s => s.reldirpath === target.reldirpath && s.uuid !== target.uuid);
if (dups.length) throw new Error('duplicate shared folder path: ' + dups.map(d=>d.uuid).join(','));

Try / catch

try { await rpc('ShareMgmt','delete',params); } catch (e) { if (String(e.message).includes('another shared folder also refers')) { /* resolve duplicate SF entry first */ } else throw e; }

Prevention

When it happens

Trigger: Calling ShareMgmt::delete (or clicking delete on a shared folder) with the option to remove content, while another shared folder in conf.system.sharedfolder has the identical reldirpath under the same parent.

Common situations: Two shared folder entries created for the same directory (e.g. after remounting a disk or duplicating an entry); a stale duplicate entry left after re-creating a filesystem with the same mount path; automation creating shared folders idempotently but with different UUIDs for the same path.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of openmediavault/openmediavault@dce610eb66 (2026-09-15). Data as JSON: /api/errors/c07b7e63b7af561e. Report an issue: GitHub.

Appendix: source

Thrown at deb/openmediavault/usr/share/openmediavault/engined/rpc/sharemgmt.inc:609

                    "operator" => "stringNotEquals",
                    "arg0" => "uuid",
                    "arg1" => $object->get("uuid")
                ],
                "arg1" => [
                    "operator" => "and",
                    "arg0" => [
                        "operator" => "stringEquals",
                        "arg0" => "mntentref",
                        "arg1" => $object->get("mntentref")
                    ],
                    "arg1" => [
                        "operator" => "stringEquals",
                        "arg0" => "reldirpath",
                        "arg1" => $object->get("reldirpath")
                    ]
                ]
            ])) {
                throw new \OMV\Exception("Cannot unlink the shared folder ".
                  "content because another shared folder also refers to it");
            }
            // Do not delete the shared folder content if a sub-directory
            // is part of another shared folder.
            $sfObjects = $db->getByFilter("conf.system.sharedfolder", [
                "operator" => "stringEquals",
                "arg0" => "mntentref",
                "arg1" => $object->get("mntentref")
            ]);
            if (!empty($sfObjects)) {
                // Get the mount point configuration object to build the
                // absolute shared folder path.
                $meObject = $db->get(
                    "conf.system.filesystem.mountpoint",
                    $object->get("mntentref")
                );
                // Build the absolute shared folder path.
                $absDirPath = \OMV\System\Os::readlink(build_path(

View on GitHub (pinned to dce610eb66)