# Getting OSError: \[WinError 123\] when using memory=true

**URL:** <https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716>\
**Category:** CrewAI Community Support\
**Tags:** memory\
**Created:** [October 10, 2024, 9:20pm UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716 "2024-10-10T21:20:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkalheber](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kkalheber](https://community.crewai.com/u/kkalheber)\
**Post date:** [October 10, 2024, 9:20pm UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716/1 "2024-10-10T21:20:54Z")

</div>

Hey there,

I wanted to start using the memory feature, but couldn’t get it to work. I am on a windows pc and as soon as I am setting memory=true for my crew, I get the following error:

```auto
OSError: [WinError 123] The syntax for the file name, directory name, or volume label is incorrect: 'C:\\Users\\{user_name}\\AppData\\Local\\CrewAI\\data_enrichment_crew/short_term/{a 840 char long name with all my agents...}'

```

I guess it’s because I have quite a complex use case with a couple of agents involved. If I am right, the folder name for the short term memory is generated by joining the agent names ([crewAI/src/crewai/memory/storage/rag\_storage.py at 02718e291b6cf2b4cedb2f2d923ce7ffc5aa9963 · crewAIInc/crewAI · GitHub](https://github.com/crewAIInc/crewAI/blob/02718e291b6cf2b4cedb2f2d923ce7ffc5aa9963/src/crewai/memory/storage/rag_storage.py#L43)). That leads to a folder name that is 840 chars long - windows has a 240 char max.

```auto
[class RAGStorage(Storage)](https://github.com/crewAIInc/crewAI/blob/02718e291b6cf2b4cedb2f2d923ce7ffc5aa9963/src/crewai/memory/storage/rag_storage.py#L27):
    """
    Extends Storage to handle embeddings for memory entries, improving
    search efficiency.
    """

    def __init__ (self, type, allow_reset=True, embedder_config=None, crew=None):
        super(). __init__ ()
        if (
            not os.getenv("OPENAI_API_KEY")
            and not os.getenv("OPENAI_BASE_URL") == "https://api.openai.com/v1"
        ):
            os.environ["OPENAI_API_KEY"] = "fake"

        agents = crew.agents if crew else []
        agents = [self._sanitize_role(agent.role) for agent in agents]
        **agents = "_".join(agents)**

        config = {
            "app": {
                "config": {"name": type, "collect_metrics": False, "log_level": "ERROR"}
            },
            "chunker": {
                "chunk_size": 5000,
                "chunk_overlap": 100,
                "length_function": "len",
                "min_chunk_size": 150,
            },
            "vectordb": {
                "provider": "chroma",
                "config": {
                    "collection_name": type,
                    **"dir": f"{db_storage_path()}/{type}/{agents}",**
                    "allow_reset": allow_reset,
                },
            },
        }

        if embedder_config:
            config["embedder"] = embedder_config
        self.type = type
        self.config = config
        self.allow_reset = allow_reset

```

Are there any workarounds? I tried setting a CustomRAG as provided in the [documentation](https://docs.crewai.com/core-concepts/Memory/#example-configuring-memory-for-a-crew), but couldn’t get it to work either…

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [October 11, 2024, 3:02am UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716/2 "2024-10-11T03:02:39Z")

</div>

what version are you on?? This was fixed a few versions back

---

<div class="post-metadata">

**Author:** ![kkalheber](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kkalheber](https://community.crewai.com/u/kkalheber)\
**Post date:** [October 11, 2024, 7:13am UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716/3 "2024-10-11T07:13:21Z")

</div>

Was not on the very latest version. I did an upgrade just now and I am now on Version 0.70.1. But the error is still there.

---

<div class="post-metadata">

**Author:** ![matt](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/matt/32/3_2.png) [@matt](https://community.crewai.com/u/matt)\
**Post date:** [October 11, 2024, 8:26am UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716/4 "2024-10-11T08:26:09Z")

</div>

In a clean environment?

---

<div class="post-metadata">

**Author:** ![nachoDRT](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/nachodrt/32/1073_2.png) [@nachoDRT](https://community.crewai.com/u/nachoDRT)\
**Post date:** [November 18, 2024, 11:45am UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716/5 "2024-11-18T11:45:04Z")

</div>

Hi, same problem here.

I am using version 0.80.0 with a clean environment, and the issue is still happening.

---

<div class="post-metadata">

**Author:** ![jklre](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@jklre](https://community.crewai.com/u/jklre)\
**Post date:** [November 24, 2024, 11:20pm UTC](https://community.crewai.com/t/getting-oserror-winerror-123-when-using-memory-true/716/6 "2024-11-24T23:20:05Z")

</div>

This was the same error I had. Windows file paths have a set limit for 256 charicters when creating file folders for memory. This issue does not seem to have been addressed. [I keep on getting invalid path when trying to execute my crew on windows. Any help would be appreciated. I'm using Version: 0.35.8 · Issue #944 · crewAIInc/crewAI · GitHub](https://github.com/crewAIInc/crewAI/issues/944#issuecomment-2242717899)

there was a workaroud posted in this old discord thread. [Discord](https://discord.com/channels/1192246288507474000/1262837666249052251)

but try reducing the agent and role names to like 1,2,3. etc
