Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xaionaro opened this issue Dec 25, 2024 · 1 comment
Open

Comments

@xaionaro
Copy link

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/[email protected]/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
@xaionaro
Copy link
Author

Log from another run:

[GIN] 2024/12/25 - 05:26:26 | 200 |   11.490827ms |      172.17.0.1 | POST     "/graphql"
[GIN] 2024/12/25 - 05:26:26 | 200 |    9.410565ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 05:26:49 Spawning container golang:latest "codel-terminal-1"
2024/12/25 05:26:49 Image golang:latest found locally: true
2024/12/25 05:26:49 Creating container codel-terminal-1...
2024/12/25 05:26:49 Container codel-terminal-1 created
2024/12/25 05:26:49 Container codel-terminal-1 started
2024/12/25 05:26:49 Getting next task
2024/12/25 05:31:04 Unmarshalling tool call: {
  "tool": "ask",
  "tool_input": {
    "Message": "My plan is to create a new working directory, then clone the two repositories and merge their code. Looking good to start with creating the new directory."
  },
  "message": "My plan is to create a new working directory, then clone the two repositories and merge their code. Looking good to start with creating the new directory."
}
2024/12/25 05:31:04 Unmarshalled tool call: {ask map[Message:My plan is to create a new working directory, then clone the two repositories and merge their code. Looking good to start with creating the new directory.] My plan is to create a new working directory, then clone the two repositories and merge their code. Looking good to start with creating the new directory.}
2024/12/25 05:31:04 Command 2 added to the queue 1
2024/12/25 05:31:04 Waiting for a task
2024/12/25 05:31:04 Processing command 2 of type ask
2024/12/25 05:31:04 Waiting for a task
2024/12/25 05:32:12 Command 3 added to the queue 1
2024/12/25 05:32:12 Processing command 3 of type input
[GIN] 2024/12/25 - 05:32:12 | 200 |   14.869205ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 05:32:12 Getting next task
2024/12/25 05:35:16 Unmarshalling tool call: {
  "tool": "terminal",
  "tool_input": {
    "Input": "mkdir merge-repos",
    "Message": "Create a new directory to store the merged repositories"
  },
  "message": "Creating a new directory to store the merged repositories"
}
2024/12/25 05:35:16 Unmarshalled tool call: {terminal map[Input:mkdir merge-repos Message:Create a new directory to store the merged repositories] Creating a new directory to store the merged repositories}
2024/12/25 05:35:16 Command 4 added to the queue 1
2024/12/25 05:35:16 Waiting for a task
2024/12/25 05:35:16 Processing command 4 of type terminal
2024/12/25 05:35:16 Getting next task
2024/12/25 05:38:26 Unmarshalling tool call: {
  "tool": "terminal",
  "tool_input": {
    "Input": "cd merge-repos",
    "Message": "Change into the newly created directory to start cloning the repositories"
  },
  "message": "Changing into the new directory to clone the repositories"
}
2024/12/25 05:38:26 Unmarshalled tool call: {terminal map[Input:cd merge-repos Message:Change into the newly created directory to start cloning the repositories] Changing into the new directory to clone the repositories}
2024/12/25 05:38:26 Command 5 added to the queue 1
2024/12/25 05:38:26 Waiting for a task
2024/12/25 05:38:26 Processing command 5 of type terminal
2024/12/25 05:38:26 Getting next task
2024/12/25 05:42:07 Unmarshalling tool call: {
  "tool": "ask",
  "tool_input": {
    "Message": "My plan is to clone the two repositories and then merge their code. I will start by cloning https://github.com/xaionaro-go/udpclone.git. Is that correct?"
  },
  "message": "Cloning the first repository"
}
2024/12/25 05:42:07 Unmarshalled tool call: {ask map[Message:My plan is to clone the two repositories and then merge their code. I will start by cloning https://github.com/xaionaro-go/udpclone.git. Is that correct?] Cloning the first repository}
2024/12/25 05:42:07 Command 6 added to the queue 1
2024/12/25 05:42:07 Waiting for a task
2024/12/25 05:42:07 Processing command 6 of type ask
2024/12/25 05:42:07 Waiting for a task
[GIN] 2024/12/25 - 11:30:46 | 200 |   14.902223ms |      172.17.0.1 | POST     "/graphql"
2024/12/25 11:30:46 Processing command 7 of type input
2024/12/25 11:30:46 Command 7 added to the queue 1
2024/12/25 11:30:46 Getting next task
2024/12/25 11:35:17 Unmarshalling tool call: {
  "tool": "terminal",
  "tool_input": {
    "Input": "git clone https://github.com/xaionaro-go/udpclone.git",
    "Message": "Cloning the first repository"
  },
  "message": "Cloning the udpclone repository to start merging the code"
}
2024/12/25 11:35:17 Unmarshalled tool call: {terminal map[Input:git clone https://github.com/xaionaro-go/udpclone.git Message:Cloning the first repository] Cloning the udpclone repository to start merging the code}
2024/12/25 11:35:17 Command 8 added to the queue 1
2024/12/25 11:35:17 Waiting for a task
2024/12/25 11:35:17 Processing command 8 of type terminal
2024/12/25 11:35:17 Getting next task
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x996921]

goroutine 85 [running]:
github.com/tmc/langchaingo/llms/ollama.(*LLM).GenerateContent(0xc000638ea0, {0x1321418, 0x19ccd60}, {0xc000516640, 0x6, 0xc000437920?}, {0xc000286e70, 0x4, 0x528960?})
	/go/pkg/mod/github.com/tmc/[email protected]/llms/ollama/ollamallm.go:148 +0x9c1
github.com/semanser/ai-coder/providers.OllamaProvider.NextTask({0xc000638ea0, {0xc00003e00d, 0x1c}, {0xc00003e042, 0x1a}, {0xf74313, 0x6}}, {{0xc000527008, 0x8, 0x8}, ...})
	/backend/providers/ollama.go:113 +0x4b8
github.com/semanser/ai-coder/executor.getNextTask({0x1322fc0, 0xc00034de80}, 0xc000624380, 0x1)
	/backend/executor/queue.go:213 +0x314
github.com/semanser/ai-coder/executor.ProcessQueue.func1()
	/backend/executor/queue.go:128 +0x8df
created by github.com/semanser/ai-coder/executor.ProcessQueue in goroutine 16
	/backend/executor/queue.go:69 +0x4cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant