cpacker / MemGPT

Create LLM agents with long-term memory and custom tools 📚🦙
https://memgpt.readme.io
Apache License 2.0
10.89k stars 1.17k forks source link

AttributeError: 'NoneType' object has no attribute 'text' #1393

Open aBaldoqui opened 2 months ago

aBaldoqui commented 2 months ago

Describe the bug When running the command sudo memgpt run --persona "personatest" --human "humantest", the system reports that it cannot find the human in the database and prompts to create it. However, when executing memgpt list humans and memgpt list personas, both the human and persona are listed as existing.

Please describe your setup

  🧬 Creating new agent...
Couldn't find human {human} in database, please run `memgpt add human`
Couldn't find persona {persona} in database, please run `memgpt add persona`
Traceback (most recent call last):
  File "/home/d0/codes/MemGPT/venv/bin/memgpt", line 8, in <module>
    sys.exit(app())
             ^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/typer/main.py", line 328, in __call__
    raise e
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/typer/main.py", line 311, in __call__
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/typer/core.py", line 783, in main
    return _main(
           ^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/typer/core.py", line 225, in _main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/venv/lib/python3.12/site-packages/typer/main.py", line 683, in wrapper
    return callback(**use_params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/d0/codes/MemGPT/memgpt/cli/cli.py", line 645, in run
    preset_obj.human = ms.get_human(human, user.id).text
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'text'
aBaldoqui commented 2 months ago

I've identified the issue. When I run memgpt list humans, it uses the SQLite database located at sqlite:////home/d0/.memgpt/sqlite.db, which contains the saved humans and personas. However, when I run sudo memgpt list humans, it uses a different SQLite database located at sqlite:////root/.memgpt/sqlite.db. As a result, it does not find the humans and personas that were created previously.

Considering the current situation where memgpt seems to utilize different database locations based on user permissions (/home/d0/.memgpt/sqlite.db for regular user and /root/.memgpt/sqlite.db for sudo), would it be feasible to explore the option of consolidating these into a single database location? This could help streamline the user experience and prevent potential discrepancies in accessing saved data.

cpacker commented 1 month ago

@sarahwooders this seems like a bug?