{"record":{"id":"cca397a613bdf78e","repo":"charmbracelet/crush","slug":"prompt-is-required","errorCode":null,"errorMessage":"prompt is required","messagePattern":"prompt is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/agentic_fetch_tool.go","lineNumber":31,"sourceCode":"\n\t\"github.com/charmbracelet/crush/internal/agent/prompt\"\n\t\"github.com/charmbracelet/crush/internal/agent/tools\"\n\t\"github.com/charmbracelet/crush/internal/permission\"\n)\n\n//go:embed templates/agentic_fetch.md\nvar agenticFetchToolDescription string\n\n// agenticFetchValidationResult holds the validated parameters from the tool call context.\ntype agenticFetchValidationResult struct {\n\tSessionID      string\n\tAgentMessageID string\n}\n\n// validateAgenticFetchParams validates the tool call parameters and extracts required context values.\nfunc validateAgenticFetchParams(ctx context.Context, params tools.AgenticFetchParams) (agenticFetchValidationResult, error) {\n\tif params.Prompt == \"\" {\n\t\treturn agenticFetchValidationResult{}, errors.New(\"prompt is required\")\n\t}\n\n\tsessionID := tools.GetSessionFromContext(ctx)\n\tif sessionID == \"\" {\n\t\treturn agenticFetchValidationResult{}, errors.New(\"session id missing from context\")\n\t}\n\n\tagentMessageID := tools.GetMessageFromContext(ctx)\n\tif agentMessageID == \"\" {\n\t\treturn agenticFetchValidationResult{}, errors.New(\"agent message id missing from context\")\n\t}\n\n\treturn agenticFetchValidationResult{\n\t\tSessionID:      sessionID,\n\t\tAgentMessageID: agentMessageID,\n\t}, nil\n}\n","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/agent/agentic_fetch_tool.go#L13-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the tool call including a non-empty prompt describing what to fetch/research.","If you construct params in code, validate strings.TrimSpace(prompt) != \"\" before calling.","Tighten the tool's JSON schema/README so the model reliably supplies prompt."],"exampleFix":"// before\nparams := tools.AgenticFetchParams{Prompt: \"\"}\n// after\nif strings.TrimSpace(prompt) == \"\" {\n    return errors.New(\"agentic fetch requires a non-empty prompt\")\n}\nparams := tools.AgenticFetchParams{Prompt: prompt}","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(params.Prompt) == \"\" {\n    return errors.New(\"agentic fetch requires a non-empty prompt\")\n}","typeGuard":null,"tryCatchPattern":"resp, err := tool.Execute(ctx, params)\nif err != nil && strings.Contains(err.Error(), \"prompt is required\") {\n    // ask the model to re-emit the tool call with a prompt\n}","preventionTips":["Validate tool-call arguments against the schema before dispatching.","Trim and check required string params in your own wrappers around agentic fetch.","Keep the tool description explicit that prompt is mandatory."],"tags":["validation","parameters","tool-call","agentic-fetch"],"backgroundTag":"missing-required-parameter","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}