Skip to content

Panic when tool fails #58

Description

@Artmann

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

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions