Panic when tool fails #29

Closed
opened 2026-02-16 17:24:54 -05:00 by yindo · 1 comment
Owner

Originally created by @Artmann on GitHub (May 25, 2025).

Sometimes when a tool call fails, there is a panic on Windows.

Panic in agent.Run: runtime error: invalid memory address or nil pointer dereference

Time: 2025-05-25T17:01:06+02:00

Stack Trace:
goroutine 1698 [running]:
runtime/debug.Stack()
	C:/Program Files (x86)/Go/src/runtime/debug/stack.go:26 +0x81
github.com/sst/opencode/internal/logging.RecoverPanic({0x1625d91, 0x9}, 0x4449fb0)
	C:/Users/Artga/Code/opencode/internal/logging/logging.go:282 +0x47f
panic({0x144a0c0, 0x27a9650})
	C:/Program Files (x86)/Go/src/runtime/panic.go:792 +0xf6
github.com/sst/opencode/internal/llm/tools/shell.(*PersistentShell).Exec(...)
	C:/Users/Artga/Code/opencode/internal/llm/tools/shell/shell.go:269
github.com/sst/opencode/internal/llm/tools.(*bashTool).Run(0x46585e0, {0x1c42de0, 0x4725188}, {{0x94ac274, 0x1e}, {0x94ac32e, 0x4}, {0x8218a20, 0x89}})
	C:/Users/Artga/Code/opencode/internal/llm/tools/bash.go:289 +0x72c
github.com/sst/opencode/internal/llm/agent.(*agent).executeToolCalls(0x46fcb40, {0x1c42de0, 0x4725188}, {0x45be900, 0x1, 0x1})
	C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:453 +0x193
github.com/sst/opencode/internal/llm/agent.(*agent).streamAndHandleEvents(0x46fcb40, {0x1c42dfc, 0x47fe330}, {0xa428210, 0x24}, {0x74d4a88, 0x1f, 0x1f})
	C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:398 +0x7f6
github.com/sst/opencode/internal/llm/agent.(*agent).processGeneration(0x46fcb40, {0x1c42dfc, 0x47fe330}, {0xa428210, 0x24}, {0x4aa69a0, 0xa4}, {0x0, 0x0, 0x0})
	C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:315 +0xa1a
github.com/sst/opencode/internal/llm/agent.(*agent).Run.func1()
	C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:188 +0x398
created by github.com/sst/opencode/internal/llm/agent.(*agent).Run in goroutine 1
	C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:179 +0x243
Originally created by @Artmann on GitHub (May 25, 2025). Sometimes when a tool call fails, there is a panic on Windows. ``` Panic in agent.Run: runtime error: invalid memory address or nil pointer dereference Time: 2025-05-25T17:01:06+02:00 Stack Trace: goroutine 1698 [running]: runtime/debug.Stack() C:/Program Files (x86)/Go/src/runtime/debug/stack.go:26 +0x81 github.com/sst/opencode/internal/logging.RecoverPanic({0x1625d91, 0x9}, 0x4449fb0) C:/Users/Artga/Code/opencode/internal/logging/logging.go:282 +0x47f panic({0x144a0c0, 0x27a9650}) C:/Program Files (x86)/Go/src/runtime/panic.go:792 +0xf6 github.com/sst/opencode/internal/llm/tools/shell.(*PersistentShell).Exec(...) C:/Users/Artga/Code/opencode/internal/llm/tools/shell/shell.go:269 github.com/sst/opencode/internal/llm/tools.(*bashTool).Run(0x46585e0, {0x1c42de0, 0x4725188}, {{0x94ac274, 0x1e}, {0x94ac32e, 0x4}, {0x8218a20, 0x89}}) C:/Users/Artga/Code/opencode/internal/llm/tools/bash.go:289 +0x72c github.com/sst/opencode/internal/llm/agent.(*agent).executeToolCalls(0x46fcb40, {0x1c42de0, 0x4725188}, {0x45be900, 0x1, 0x1}) C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:453 +0x193 github.com/sst/opencode/internal/llm/agent.(*agent).streamAndHandleEvents(0x46fcb40, {0x1c42dfc, 0x47fe330}, {0xa428210, 0x24}, {0x74d4a88, 0x1f, 0x1f}) C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:398 +0x7f6 github.com/sst/opencode/internal/llm/agent.(*agent).processGeneration(0x46fcb40, {0x1c42dfc, 0x47fe330}, {0xa428210, 0x24}, {0x4aa69a0, 0xa4}, {0x0, 0x0, 0x0}) C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:315 +0xa1a github.com/sst/opencode/internal/llm/agent.(*agent).Run.func1() C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:188 +0x398 created by github.com/sst/opencode/internal/llm/agent.(*agent).Run in goroutine 1 C:/Users/Artga/Code/opencode/internal/llm/agent/agent.go:179 +0x243 ```
yindo closed this issue 2026-02-16 17:24:54 -05:00
Author
Owner

@thdxr commented on GitHub (Jun 14, 2025):

going to close for now as 0.1.x is a rewrite. feel free to open a new issue if it's still a problem

@thdxr commented on GitHub (Jun 14, 2025): going to close for now as 0.1.x is a rewrite. feel free to open a new issue if it's still a problem
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#29