[GH-ISSUE #1013] [BUG]: Unable to start docker containers - node errors #623

Closed
opened 2026-02-22 18:20:31 -05:00 by yindo · 18 comments
Owner

Originally created by @arsaboo on GitHub (Apr 2, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1013

How are you running AnythingLLM?

Docker (local)

What happened?

Here's my docker compose file:

version: "3.9"
services:
  anythingllm:
    image: mintplexlabs/anythingllm
    container_name: anythingllm
    ports:
      - "3001:3001"
    cap_add:
      - SYS_ADMIN
    volumes:
      - "/mnt/docker/containers/anythingllm/:/app/server/storage"

But, I get this error when I start the container.

node:internal/validators:162
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:405:5)
    at validateString (node:internal/validators:162:11)
    at Object.resolve (node:path:1097:7)
    at Object.<anonymous> (/app/collector/utils/comKey/index.js:8:12)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18) {
  code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v18.19.1

Both node and yarn are installed.

$node --version
v18.20.0
$ yarn --version
1.22.22

Are there known steps to reproduce?

No response

Originally created by @arsaboo on GitHub (Apr 2, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1013 ### How are you running AnythingLLM? Docker (local) ### What happened? Here's my docker compose file: ```yaml version: "3.9" services: anythingllm: image: mintplexlabs/anythingllm container_name: anythingllm ports: - "3001:3001" cap_add: - SYS_ADMIN volumes: - "/mnt/docker/containers/anythingllm/:/app/server/storage" ``` But, I get this error when I start the container. ```bash node:internal/validators:162 throw new ERR_INVALID_ARG_TYPE(name, 'string', value); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received undefined at new NodeError (node:internal/errors:405:5) at validateString (node:internal/validators:162:11) at Object.resolve (node:path:1097:7) at Object.<anonymous> (/app/collector/utils/comKey/index.js:8:12) at Module._compile (node:internal/modules/cjs/loader:1356:14) at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) at Module.load (node:internal/modules/cjs/loader:1197:32) at Module._load (node:internal/modules/cjs/loader:1013:12) at Module.require (node:internal/modules/cjs/loader:1225:19) at require (node:internal/modules/helpers:177:18) { code: 'ERR_INVALID_ARG_TYPE' } Node.js v18.19.1 ``` Both `node` and `yarn` are installed. ```bash $node --version v18.20.0 $ yarn --version 1.22.22 ``` ### Are there known steps to reproduce? _No response_
yindo added the possible bug label 2026-02-22 18:20:31 -05:00
yindo closed this issue 2026-02-22 18:20:31 -05:00
Author
Owner

@timothycarambat commented on GitHub (Apr 2, 2024):

https://github.com/Mintplex-Labs/anything-llm/issues/1007

@timothycarambat commented on GitHub (Apr 2, 2024): https://github.com/Mintplex-Labs/anything-llm/issues/1007
Author
Owner

@arsaboo commented on GitHub (Apr 2, 2024):

@timothycarambat I deleted the stack (in portainer) and recreated it, but still getting the same error. Anything else that I am supposed to do?

@arsaboo commented on GitHub (Apr 2, 2024): @timothycarambat I deleted the stack (in portainer) and recreated it, but still getting the same error. Anything else that I am supposed to do?
Author
Owner

@timothycarambat commented on GitHub (Apr 2, 2024):

Are you sure the docker user can even write or create a folder on /mnt/docker/containers/anythingllm since that seems like it could also throw this error given that error is from node bootup and not even from the code here in the repo.

@timothycarambat commented on GitHub (Apr 2, 2024): Are you sure the docker user can even write or create a folder on `/mnt/docker/containers/anythingllm` since that seems like it could also throw this error given that error is from node bootup and not even from the code here in the repo.
Author
Owner

@arsaboo commented on GitHub (Apr 3, 2024):

I think that may be the issue. When I changed the folder location, it worked. I have all my other containers in /mnt/docker/containers/.

@arsaboo commented on GitHub (Apr 3, 2024): I think that may be the issue. When I changed the folder location, it worked. I have all my other containers in `/mnt/docker/containers/`.
Author
Owner

@timothycarambat commented on GitHub (Apr 3, 2024):

This is because there is no STORAGE_DIR env set when booting the container.

path.resolve(process.env.STORAGE_DIR, comkey); will resolve to path.resolve(undefined, 'comkey')

Set a STORAGE_DIR env, which is outlined in our Recommend way to use docker

@timothycarambat commented on GitHub (Apr 3, 2024): This is because there is no `STORAGE_DIR` env set when booting the container. `path.resolve(process.env.STORAGE_DIR, `comkey`);` will resolve to `path.resolve(undefined, 'comkey')` Set a STORAGE_DIR env, which is outlined in our [Recommend way to use docker](https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md#recommend-way-to-run-dockerized-anythingllm)
Author
Owner

@arsaboo commented on GitHub (Apr 3, 2024):

I actually had to remove this part -v ${STORAGE_LOCATION}/.env:/app/server/.env \ for the containers to run (on MacOS).

@arsaboo commented on GitHub (Apr 3, 2024): I actually had to remove this part `-v ${STORAGE_LOCATION}/.env:/app/server/.env \` for the containers to run (on MacOS).
Author
Owner

@timothycarambat commented on GitHub (Apr 3, 2024):

Then that is why you have the error. Often people trying writing to a root directory like /var /lib or /dev. In MacOS you cannot bind to those directories as the user and it must be a /user/ scoped folder. That is why the start of that command begins with $HOME, so the folder being created is within scope of the user.

@timothycarambat commented on GitHub (Apr 3, 2024): Then that is why you have the error. Often people trying writing to a root directory like /var /lib or /dev. In MacOS you cannot bind to those directories as the user and it must be a /user/ scoped folder. That is why the start of that command begins with $HOME, so the folder being created is within scope of the user.
Author
Owner

@arsaboo commented on GitHub (Apr 4, 2024):

Even with that....it gives some error:

export STORAGE_LOCATION=$HOME/Documents/Containers/anythingllm && \
mkdir -p $STORAGE_LOCATION && \
touch "$STORAGE_LOCATION/.env" && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm
21a885006a24066ace2c5fa4cf343e167ebd15caf457b1f24ed6dc404e22db82
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env" to rootfs at "/app/server/.env": mount /host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
@arsaboo commented on GitHub (Apr 4, 2024): Even with that....it gives some error: ```bash export STORAGE_LOCATION=$HOME/Documents/Containers/anythingllm && \ mkdir -p $STORAGE_LOCATION && \ touch "$STORAGE_LOCATION/.env" && \ docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm 21a885006a24066ace2c5fa4cf343e167ebd15caf457b1f24ed6dc404e22db82 docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env" to rootfs at "/app/server/.env": mount /host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. ```
Author
Owner

@timothycarambat commented on GitHub (Apr 4, 2024):

Is this on windows?

@timothycarambat commented on GitHub (Apr 4, 2024): Is this on windows?
Author
Owner

@arsaboo commented on GitHub (Apr 4, 2024):

Mac (Studio)

@arsaboo commented on GitHub (Apr 4, 2024): Mac (Studio)
Author
Owner

@timothycarambat commented on GitHub (Apr 4, 2024):

Can you pull in latest image! Just patched it with a fix that should work now

@timothycarambat commented on GitHub (Apr 4, 2024): Can you pull in latest image! Just patched it with a fix that should work now
Author
Owner

@arsaboo commented on GitHub (Apr 4, 2024):

Still the same error with the latest image:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env" to rootfs at "/app/server/.env": mount /host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
@arsaboo commented on GitHub (Apr 4, 2024): Still the same error with the latest image: ``` docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env" to rootfs at "/app/server/.env": mount /host_mnt/Users/asaboo/Documents/Containers/anythingllm/.env:/app/server/.env (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type. ```
Author
Owner

@arsaboo commented on GitHub (Apr 4, 2024):

A quick google search shows others having this issue as well.

Maybe a stupid question, but why do we need the touch "$STORAGE_LOCATION/.env" and -v ${STORAGE_LOCATION}/.env:/app/server/.env \ parts? I have other containers working perfectly on my Mac. Even anything works fine with the following command (not sure if I am missing anything with the following):

docker run -d -p 3001:3001 --name anythingllm --cap-add SYS_ADMIN -v ${STORAGE_LOCATION}:/app/server/storage -e STORAGE_DIR="/app/server/storage" mintplexlabs/anythingllm
@arsaboo commented on GitHub (Apr 4, 2024): A quick google search shows others having this issue as well. Maybe a stupid question, but why do we need the `touch "$STORAGE_LOCATION/.env"` and `-v ${STORAGE_LOCATION}/.env:/app/server/.env \` parts? I have other containers working perfectly on my Mac. Even anything works fine with the following command (not sure if I am missing anything with the following): ``` docker run -d -p 3001:3001 --name anythingllm --cap-add SYS_ADMIN -v ${STORAGE_LOCATION}:/app/server/storage -e STORAGE_DIR="/app/server/storage" mintplexlabs/anythingllm ```
Author
Owner

@timothycarambat commented on GitHub (Apr 4, 2024):

It just ensures there is a valid .env for when the container starts and then we bind that env that is visible on your local machine with the docker container's .env. This is because if you dont do this, when you update your LLM, Embedder, or anything like that, those changes will be blown away when you want to pull in the latest image and restart the container on the newest image.

It very well may be the case the .env bind is not needed since the storage location bind exists

@timothycarambat commented on GitHub (Apr 4, 2024): It just ensures there is a valid `.env` for when the container starts and then we bind that env that is visible on your local machine with the docker container's `.env`. This is because if you dont do this, when you update your LLM, Embedder, or anything like that, those changes will be blown away when you want to pull in the latest image and restart the container on the newest image. It very well may be the case the .env bind is not needed since the storage location bind exists
Author
Owner

@arsaboo commented on GitHub (Apr 5, 2024):

The storage location bound does not solve the issue....indeed, I lost all the configurations after the update today.

So, I started debugging and it turns out that .env was a folder and not a file.

I removed the .env folder and created a .env file. Now the original docker command works fine.

docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN --name anythingllm \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

BTW, this is the first time I am seeing this approach to saving environmental variables. Typically a config folder is used to save such details so that things are not overwritten (look at the *arr containers). The variables we are saving here are configuration related and not really environmental variables. I understand if you prefer to keep it the way it is, but something to think about.

@arsaboo commented on GitHub (Apr 5, 2024): The storage location bound does not solve the issue....indeed, I lost all the configurations after the update today. So, I started debugging and it turns out that `.env` was a folder and not a file. I removed the `.env` folder and created a `.env` file. Now the original docker command works fine. ```yaml docker run -d -p 3001:3001 \ --cap-add SYS_ADMIN --name anythingllm \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ``` BTW, this is the first time I am seeing this approach to saving environmental variables. Typically a config folder is used to save such details so that things are not overwritten (look at the *arr containers). The variables we are saving here are configuration related and not really environmental variables. I understand if you prefer to keep it the way it is, but something to think about.
Author
Owner

@timothycarambat commented on GitHub (Apr 5, 2024):

I concur, it truly isnt ideal. Its really a holdover that is hard to shake from the very very first version of the project :/

@timothycarambat commented on GitHub (Apr 5, 2024): I concur, it truly isnt ideal. Its really a holdover that is hard to shake from the very very first version of the project :/
Author
Owner

@arsaboo commented on GitHub (Apr 5, 2024):

No worries at all....at least we know what the issue was, and hopefully, it will help users in the future. Thanks for your great work on the project.

@arsaboo commented on GitHub (Apr 5, 2024): No worries at all....at least we know what the issue was, and hopefully, it will help users in the future. Thanks for your great work on the project.
Author
Owner

@JOduMonT commented on GitHub (Dec 17, 2024):

I actually had to remove this part -v ${STORAGE_LOCATION}/.env:/app/server/.env \ for the containers to run (on MacOS).

I also had to remove the /app/server/.env to make it run on my Linux Server.

Anyway; .env isn't for container itself ?

@JOduMonT commented on GitHub (Dec 17, 2024): > I actually had to remove this part `-v ${STORAGE_LOCATION}/.env:/app/server/.env \` for the containers to run (on MacOS). I also had to remove the /app/server/.env to make it run on my Linux Server. Anyway; .env isn't for container itself ?
yindo changed title from [BUG]: Unable to start docker containers - node errors to [GH-ISSUE #1013] [BUG]: Unable to start docker containers - node errors 2026-06-05 14:36:20 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#623