AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

when running on Kali linux will get error: 'NoneType' object has no attribute 'get'

Open r4zmuz opened this issue 2 years ago • 1 comments

⚠️ Search for existing issues first ⚠️

  • [X] I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Other (Please specify in your problem)

Which version of Auto-GPT are you using?

Master (branch)

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

when running first time on kali linux if there is nothing saved inside ai_setting.yaml.

Current behavior 😯

Exception has occurred: AttributeError 'NoneType' object has no attribute 'get' File "/media/kali/4b9de0e2-9707-470a-a3e1-2d9ecd620795/python_projects/AutoGPT/Auto-GPT/autogpt/config/ai_config.py", line 67, in load ai_name = config_params.get("ai_name", "") ^^^^^^^^^^^^^^^^^ File "/media/kali/4b9de0e2-9707-470a-a3e1-2d9ecd620795/python_projects/AutoGPT/Auto-GPT/autogpt/prompt.py", line 173, in construct_prompt config = AIConfig.load(CFG.ai_settings_file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/media/kali/4b9de0e2-9707-470a-a3e1-2d9ecd620795/python_projects/AutoGPT/Auto-GPT/autogpt/cli.py", line 126, in main system_prompt = construct_prompt() ^^^^^^^^^^^^^^^^^^ File "/media/kali/4b9de0e2-9707-470a-a3e1-2d9ecd620795/python_projects/AutoGPT/Auto-GPT/run_autogpt.py", line 4, in main.autogpt.cli.main() AttributeError: 'NoneType' object has no attribute 'get'

Expected behavior 🤔

It should not throw an error but error should be handled without exiting application.

here is one possible quick fix for it.

in directory: autogpt/ai_config.py

-    ai_name = config_params.get("ai_name", "")
-    ai_role = config_params.get("ai_role", "")
-    ai_goals = config_params.get("ai_goals", [])
-    return AIConfig(ai_name, ai_role, ai_goals)
+ try:
+            ai_name = config_params.get("ai_name", "")
+            ai_role = config_params.get("ai_role", "")
+            ai_goals = config_params.get("ai_goals", [])
+        except AttributeError:
+            ai_name = ""
+            ai_role = ""
+            ai_goals = []
+        finally:
+            # type: Type[AIConfig]
+            return AIConfig(ai_name, ai_role, ai_goals)

Your prompt 📝

# this file is also empty

Your Logs 📒

# this error is not showing here. this file is empty

r4zmuz avatar Apr 23 '23 19:04 r4zmuz

I have the similar/same issue running with MacBook M1 via the docker instructions from the setup documentation, fresh install as of today. MacOS 12.4, Docker Desktop v4.9.1 (updating soon). I found this ticket searching the issues for the final error line. Could just be a documentation update for setup instructions for us newbs is to provide more explicit listing of the Configuration files required and their location to create before running the image.

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/app/autogpt/__main__.py", line 5, in <module>
    autogpt.cli.main()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke
    rv = super().invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/app/autogpt/cli.py", line 90, in main
    run_auto_gpt(
  File "/app/autogpt/main.py", line 135, in run_auto_gpt
    ai_config = construct_main_ai_config()
  File "/app/autogpt/prompts/prompt.py", line 88, in construct_main_ai_config
    config = AIConfig.load(CFG.ai_settings_file)
  File "/app/autogpt/config/ai_config.py", line 80, in load
    ai_name = config_params.get("ai_name", "")
AttributeError: 'NoneType' object has no attribute 'get'

jackvargo avatar May 04 '23 04:05 jackvargo

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] avatar Sep 06 '23 21:09 github-actions[bot]

This issue was closed automatically because it has been stale for 10 days with no activity.

github-actions[bot] avatar Sep 18 '23 01:09 github-actions[bot]