Skip to content

panic: runtime error: invalid memory address or nil pointer dereference #74

Description

@xaionaro

Just providing a bugreport. I've tried to use ollama as the backend, and received error:

panic: runtime error: invalid memory address or nil pointer dereference

Here's the log:

[GIN] 2024/12/25 - 03:38:31 | 200 |    14.39499ms |      172.17.0.1 | POST     "/graphql"
[GIN] 2024/12/25 - 03:38:31 | 200 |     341.978µs |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:38:31 Command 31 added to the queue 7
2024/12/25 03:38:31 Processing command 31 of type input
[GIN] 2024/12/25 - 03:38:31 | 200 |    6.773211ms |      172.17.0.1 | POST     "/graphql"
[GIN] 2024/12/25 - 03:38:31 | 200 |    8.781044ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:38:34 Spawning container nginx:latest "codel-terminal-7"
2024/12/25 03:38:34 Image nginx:latest found locally: true
2024/12/25 03:38:34 Creating container codel-terminal-7...
2024/12/25 03:38:34 Container codel-terminal-7 created
2024/12/25 03:38:34 Container codel-terminal-7 started
2024/12/25 03:38:34 Getting next task
2024/12/25 03:38:36 Unmarshalling tool call: {
  "tool": "ask",
  "tool_input": {
    "Message": "What is the task you want to accomplish?"
  },
  "message": "I need more information from you to proceed with the task."
}
2024/12/25 03:38:36 Unmarshalled tool call: {ask map[Message:What is the task you want to accomplish?] I need more information from you to proceed with the task.}
2024/12/25 03:38:36 Command 32 added to the queue 7
2024/12/25 03:38:36 Waiting for a task
2024/12/25 03:38:36 Processing command 32 of type ask
2024/12/25 03:38:36 Waiting for a task
2024/12/25 03:38:45 Command 33 added to the queue 7
2024/12/25 03:38:45 Processing command 33 of type input
[GIN] 2024/12/25 - 03:38:45 | 200 |    14.23676ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:38:45 Getting next task
2024/12/25 03:38:47 Unmarshalling tool call: {
  "tool": "terminal",
  "tool_input": {
    "Input": "go get -u github.com/xaionaro/go-udp",
    "Message": "Installing required Go packages"
  },
  "message": "Installing required Go packages. Please wait for a moment."
}
2024/12/25 03:38:47 Unmarshalled tool call: {terminal map[Input:go get -u github.com/xaionaro/go-udp Message:Installing required Go packages] Installing required Go packages. Please wait for a moment.}
2024/12/25 03:38:47 Command 34 added to the queue 7
2024/12/25 03:38:47 Waiting for a task
2024/12/25 03:38:47 Processing command 34 of type terminal
2024/12/25 03:38:47 Getting next task
2024/12/25 03:38:49 Unmarshalling tool call: {
  "tool": "ask",
  "tool_input": {
    "Message": "What is the task you want to accomplish?"
  },
  "message": "I need more information from you to proceed with the task."
}
2024/12/25 03:38:49 Unmarshalled tool call: {ask map[Message:What is the task you want to accomplish?] I need more information from you to proceed with the task.}
2024/12/25 03:38:49 Command 35 added to the queue 7
2024/12/25 03:38:49 Waiting for a task
2024/12/25 03:38:49 Processing command 35 of type ask
2024/12/25 03:38:49 Waiting for a task
2024/12/25 03:38:55 Command 36 added to the queue 7
2024/12/25 03:38:55 Processing command 36 of type input
[GIN] 2024/12/25 - 03:38:55 | 200 |    7.820124ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:38:55 Getting next task
2024/12/25 03:38:56 Unmarshalling tool call: {
  "tool": "ask",
  "tool_input": {
    "Message": "What is the task you want to accomplish?"
  },
  "message": "I need more information from you to proceed with the task."
}
2024/12/25 03:38:56 Unmarshalled tool call: {ask map[Message:What is the task you want to accomplish?] I need more information from you to proceed with the task.}
2024/12/25 03:38:56 Command 37 added to the queue 7
2024/12/25 03:38:56 Waiting for a task
2024/12/25 03:38:56 Processing command 37 of type ask
2024/12/25 03:38:56 Waiting for a task
[GIN] 2024/12/25 - 03:39:15 | 200 |    8.062403ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:39:15 Command 38 added to the queue 7
2024/12/25 03:39:15 Processing command 38 of type input
2024/12/25 03:39:15 Getting next task
2024/12/25 03:39:17 Unmarshalling tool call: {
  "tool": "terminal",
  "tool_input": {"Input": "apt-get update && apt-get install -y build-essential", "Message": "Updating and installing necessary dependencies."},
  "message": "Updating and installing necessary dependencies."
}
2024/12/25 03:39:17 Unmarshalled tool call: {terminal map[Input:apt-get update && apt-get install -y build-essential Message:Updating and installing necessary dependencies.] Updating and installing necessary dependencies.}
2024/12/25 03:39:17 Command 39 added to the queue 7
2024/12/25 03:39:17 Waiting for a task
2024/12/25 03:39:17 Processing command 39 of type terminal
2024/12/25 03:39:30 Getting next task
2024/12/25 03:39:32 Unmarshalling tool call: {"error":"Invalid request","code":"UNAUTHORIZED_ACCESS","message":"API usage is restricted to registered users only."}
2024/12/25 03:39:32 Failed to convert text to the next task, asking user
2024/12/25 03:39:32 Command 40 added to the queue 7
2024/12/25 03:39:32 Waiting for a task
2024/12/25 03:39:32 Processing command 40 of type ask
2024/12/25 03:39:32 Waiting for a task
2024/12/25 03:39:56 Command 41 added to the queue 7
[GIN] 2024/12/25 - 03:39:56 | 200 |    9.486551ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:39:56 Processing command 41 of type input
2024/12/25 03:39:56 Getting next task
2024/12/25 03:39:57 Unmarshalling tool call: {"error": {"code": 500, "message": "Internal Server Error", "data": null}}
2024/12/25 03:39:57 Failed to convert text to the next task, asking user
2024/12/25 03:39:57 Command 42 added to the queue 7
2024/12/25 03:39:57 Waiting for a task
2024/12/25 03:39:57 Processing command 42 of type ask
2024/12/25 03:39:57 Waiting for a task
2024/12/25 03:40:11 Command 43 added to the queue 7
[GIN] 2024/12/25 - 03:40:11 | 200 |   15.764073ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 03:40:11 Processing command 43 of type input
2024/12/25 03:40:11 Getting next task
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x996921]

goroutine 580 [running]:
github.com/tmc/langchaingo/llms/ollama.(*LLM).GenerateContent(0xc000932120, {0x1321418, 0x19ccd60}, {0xc00017edc8, 0xc, 0xc000937230?}, {0xc000a56e70, 0x4, 0x528960?})
	/go/pkg/mod/github.com/tmc/langchaingo@v0.1.8/llms/ollama/ollamallm.go:148 +0x9c1
github.com/semanser/ai-coder/providers.OllamaProvider.NextTask({0xc000932120, {0xc00003a025, 0x8}, {0xc000042012, 0x1a}, {0xf74313, 0x6}}, {{0xc000135008, 0xd, 0x11}, ...})
	/backend/providers/ollama.go:113 +0x4b8
github.com/semanser/ai-coder/executor.getNextTask({0x1322fc0, 0xc000617e40}, 0xc000318020, 0x7)
	/backend/executor/queue.go:213 +0x314
github.com/semanser/ai-coder/executor.ProcessQueue.func1()
	/backend/executor/queue.go:102 +0x54f
created by github.com/semanser/ai-coder/executor.ProcessQueue in goroutine 444
	/backend/executor/queue.go:69 +0x4cb

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions