Skip to content

panic in ScriptToolSet.Instructions when a script shell tool arg has no description #3071

Closed

Description

@simonferquel-clanker

Summary

cagent panics at session start with interface conversion: interface {} is nil, not string when a script toolset defines a shell tool whose arg omits description.

The crash is in ScriptToolSet.Instructions() (pkg/tools/builtin/shell/script_shell.go:104, v1.74.0):

description := argDef.(map[string]any)["description"].(string)

If the arg definition has no description key, the map lookup returns nil and the type assertion panics. The outer argDef.(map[string]any) assertion can also panic if the arg definition is not a mapping (e.g. name: string shorthand or a null value).

Reproduction

agents:
  root:
    model: anthropic/claude-sonnet-4-6
    toolsets:
      - type: script
        shell:
          greet:
            cmd: echo hello ${name}
            args:
              name:
                type: string   # no description -> panic
            required: [name]

Start a session with any prompt. The runtime panics before the first model call, while building the system messages:

panic: interface conversion: interface {} is nil, not string

github.com/docker/docker-agent/pkg/tools/builtin/shell.(*ScriptToolSet).Instructions
        pkg/tools/builtin/shell/script_shell.go:104
github.com/docker/docker-agent/pkg/tools.GetInstructions
        pkg/tools/capabilities.go:72
github.com/docker/docker-agent/pkg/session.buildInvariantSystemMessages
        pkg/session/session.go:918
github.com/docker/docker-agent/pkg/session.(*Session).GetMessages
        pkg/session/session.go:1053
github.com/docker/docker-agent/pkg/runtime.(*LocalRuntime).runStreamLoop
        pkg/runtime/loop.go:261

Why this is surprising

  • The config loads and validates fine; NewScript/validateConfig accept it. The failure only surfaces mid-session, deep in message building, as a hard crash of the whole process.
  • The rest of the toolset already treats description as optional: Tools() falls back with cmp.Or(cfg.Description, ...) and defaultPropertyTypes() uses a comma-ok assertion. Instructions() is the only code path that hard-requires it.

Suggested fix

description should be either optional or rejected at config load time — anything but a runtime panic:

  1. Make it optional in Instructions() (preferred, consistent with Tools()): use comma-ok assertions and fall back to an empty/Runs: cmd description when missing; skip or stringify non-map arg defs.
  2. Or validate at config load: extend validateConfig() (or schema validation in pkg/config) to require a string description per arg and return a clear error like tool 'greet' arg 'name' is missing a description, so the config is refused up front instead of crashing the session.

Happy to provide more detail if useful.

Activity

  1. added
    area/tools
    area/config
    on Jun 11, 2026
  2. added theissue type on Jun 11, 2026
  3. added a commit that references this issue on Jun 11, 2026
    67d2288
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

    area/configarea/tools

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions