payloadcms / payloadcms/payload

Filename unique error for media when using multi-tenant-plugin

Open
#15,151 3 comments 0 reactions 1 assignee View on GitHub

@JarrodMFlesch is already working on this.

Since Jan 23, 2026.

plugin: multi-tenant
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

When using the multi-tenant-plugin, uploading a media file with a filename that already exists under a different tenant triggers a validation error. The error occurs even though the filename is unique within the current tenant.

Expected behavior:

The media file should upload successfully since the filename is unique within the context of Tenant B.

Actual behavior:

A validation error is returned:

{
    "errors": [
        {
            "name": "ValidationError",
            "data": {
                "errors": [
                    {
                        "message": "Value must be unique",
                        "path": "filename"
                    }
                ]
            },
            "message": "The following field is invalid: filename"
        }
    ]
}
Notes:

The error seems to enforce global uniqueness rather than tenant-scoped uniqueness.

This issue prevents uploading files with the same name across different tenants.

Link to the code that reproduces this issue
Reproduction Steps

Set up multiple tenants using the multi-tenant-plugin.

Upload a media file (e.g., image.jpg) under Tenant A.

Switch to Tenant B and try to upload a media file with the same filename (image.jpg).

Which area(s) are affected?

plugin: multi-tenant

Environment Info
Payload version: 3.69.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.