charmbracelet/crush · error

prompt is required

Error message

prompt is required

What it means

validateAgenticFetchParams in internal/agent/agentic_fetch_tool.go checks the AgenticFetchParams before running the small-model fetch agent. A prompt is the actual instruction the fetch agent executes; an empty prompt would produce a meaningless sub-run, so the validator rejects it with this error.

Source

Thrown at internal/agent/agentic_fetch_tool.go:31

	"github.com/charmbracelet/crush/internal/agent/prompt"
	"github.com/charmbracelet/crush/internal/agent/tools"
	"github.com/charmbracelet/crush/internal/permission"
)

//go:embed templates/agentic_fetch.md
var agenticFetchToolDescription string

// agenticFetchValidationResult holds the validated parameters from the tool call context.
type agenticFetchValidationResult struct {
	SessionID      string
	AgentMessageID string
}

// validateAgenticFetchParams validates the tool call parameters and extracts required context values.
func validateAgenticFetchParams(ctx context.Context, params tools.AgenticFetchParams) (agenticFetchValidationResult, error) {
	if params.Prompt == "" {
		return agenticFetchValidationResult{}, errors.New("prompt is required")
	}

	sessionID := tools.GetSessionFromContext(ctx)
	if sessionID == "" {
		return agenticFetchValidationResult{}, errors.New("session id missing from context")
	}

	agentMessageID := tools.GetMessageFromContext(ctx)
	if agentMessageID == "" {
		return agenticFetchValidationResult{}, errors.New("agent message id missing from context")
	}

	return agenticFetchValidationResult{
		SessionID:      sessionID,
		AgentMessageID: agentMessageID,
	}, nil
}

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Retry the tool call including a non-empty prompt describing what to fetch/research.
  2. If you construct params in code, validate strings.TrimSpace(prompt) != "" before calling.
  3. Tighten the tool's JSON schema/README so the model reliably supplies prompt.

Example fix

// before
params := tools.AgenticFetchParams{Prompt: ""}
// after
if strings.TrimSpace(prompt) == "" {
    return errors.New("agentic fetch requires a non-empty prompt")
}
params := tools.AgenticFetchParams{Prompt: prompt}
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(params.Prompt) == "" {
    return errors.New("agentic fetch requires a non-empty prompt")
}

Try / catch

resp, err := tool.Execute(ctx, params)
if err != nil && strings.Contains(err.Error(), "prompt is required") {
    // ask the model to re-emit the tool call with a prompt
}

Prevention

When it happens

Trigger: The LLM (or caller) invokes the agentic_fetch tool with params.Prompt == "" — e.g. the model emits a tool call omitting the required prompt field or passing an empty string.

Common situations: Model hallucinating a malformed tool call with a missing prompt argument; client code constructing AgenticFetchParams programmatically and leaving Prompt unset; prompt trimming stripping whitespace-only input to empty.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/cca397a613bdf78e. Report an issue: GitHub.