# Error " \[INVALID\_FOREIGN\_KEY\] Invalid foreign key." uploading files

**URL:** https://community.directus.com/t/error-invalid-foreign-key-invalid-foreign-key-uploading-files/510
**Category:** Help
**Created:** [June 8, 2025, 6:24am UTC](https://community.directus.com/t/error-invalid-foreign-key-invalid-foreign-key-uploading-files/510 "2025-06-08T06:24:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![thepurpleblob](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/thepurpleblob/32/454_2.png) [@thepurpleblob](https://community.directus.com/u/thepurpleblob)
#### Post date: [June 8, 2025, 6:24am UTC](https://community.directus.com/t/error-invalid-foreign-key-invalid-foreign-key-uploading-files/510/1 "2025-06-08T06:24:44Z")

</div>

Directus version 11.8.1 running in Docker.

I set up Directus locally using Docker and everything worked fine. I then moved the container to my production server. I copied the external volumes containing uploads and the SQlite database. Again, it all worked. My application read from the API and the app mostly worked.

However, I can no longer upload files in the files area (or in a file field in a collection). I get the above error and the logs show…

```auto
[06:19:53] GET /files?filter[_and][0][type][_nnull]=true&filter[_and][1][folder][_null]=true&aggregate[countDistinct]=id 200 19ms
[06:19:53.066] ERROR: The "path" argument must be of type string. Received null
    err: {
      "type": "TypeError",
      "message": "The \"path\" argument must be of type string. Received null",
      "stack":
          TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
              at join (node:path:1268:7)
              at DriverLocal.fullPath (file:///directus/node_modules/.pnpm/@directus+storage-driver-local@file+packages+storage-driver-local/node_modules/@directus/storage-driver-local/dist/index.js:14:28)
              at DriverLocal.exists (file:///directus/node_modules/.pnpm/@directus+storage-driver-local@file+packages+storage-driver-local/node_modules/@directus/storage-driver-local/dist/index.js:44:24)
              at AssetsService.getAsset (file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.13.8_@unhead+vue@1.11.20_vue@3.5.13_typescript@5.8.2 ____ jigekj2vspo2admkgggvl64evi/node_modules/@directus/api/dist/services/assets.js:54:61)
              at async file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.13.8_@unhead+vue@1.11.20_vue@3.5.13_typescript@5.8.2 ____ jigekj2vspo2admkgggvl64evi/node_modules/@directus/api/dist/controllers/assets.js:154:36
      "code": "ERR_INVALID_ARG_TYPE"
    }

```

Any ideas?

---

<div class="post-metadata">

### Author: ![bryantgillespie](https://sea2.discourse-cdn.com/flex002/user_avatar/community.directus.com/bryantgillespie/32/33_2.png) [@bryantgillespie](https://community.directus.com/u/bryantgillespie)
#### Post date: [June 14, 2025, 3:27pm UTC](https://community.directus.com/t/error-invalid-foreign-key-invalid-foreign-key-uploading-files/510/2 "2025-06-14T15:27:04Z")

</div>

Are there any differences between the environment variables and the configuration between your local and production setups?

If you’re using SQLite, obviously it’s just a file, so that should work okay. But it seems like your production setup and your local setup are different.
