crewai - ✅(Solved) Fix [BUG] Recall Memory Tool fails with missing required positional argument [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
crewAIInc/crewAI#4611Fetched 2026-04-08 00:40:58
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Participants
Timeline (top)
referenced ×3cross-referenced ×2closed ×1labeled ×1

I've got a simple crew running against the main branch. When I run it I'm seeing this error in the output: Tool search_memory executed with result: Error executing tool: RecallMemoryTool._run() missing 1 required positional argument: 'queries'... ╭──────────────────────────────────────────────────────────────────────────── 🔧 Tool Error (#1) ─────────────────────────────────────────────────────────────────────────────╮ │ │ │ Tool Failed │ │ Tool: search_memory │ │ Iteration: 1 │ │ Attempt: 0 │ │ Error: RecallMemoryTool._run() missing 1 required positional argument: 'queries'

Error Message

I've got a simple crew running against the main branch. When I run it I'm seeing this error in the output: Tool search_memory executed with result: Error executing tool: RecallMemoryTool._run() missing 1 required positional argument: 'queries'... ╭──────────────────────────────────────────────────────────────────────────── 🔧 Tool Error (#1) ─────────────────────────────────────────────────────────────────────────────╮ │ Error: RecallMemoryTool._run() missing 1 required positional argument: 'queries' I run crewai run and all my search_memory tools generate the error Tool search_memory executed with result: Error executing tool: RecallMemoryTool._run() missing 1 required positional argument: 'queries'... I expect there to be no error I'm working on building a valkey implementation of the new Storage Backend and working on testing it to make sure it works. This example code is using lancedb instead to simplify the crew to reproduce the error - though I was getting it in my valkey-supported version. The error occurs with both the main branch and my feature branch , which suggests it is unrelated to my feature branch. I know that this is bleeding edge. I'm wondering if this is a known issue with a timeline, or a not-yet known issue.

Root Cause

I've got a simple crew running against the main branch. When I run it I'm seeing this error in the output: Tool search_memory executed with result: Error executing tool: RecallMemoryTool._run() missing 1 required positional argument: 'queries'... ╭──────────────────────────────────────────────────────────────────────────── 🔧 Tool Error (#1) ─────────────────────────────────────────────────────────────────────────────╮ │ │ │ Tool Failed │ │ Tool: search_memory │ │ Iteration: 1 │ │ Attempt: 0 │ │ Error: RecallMemoryTool._run() missing 1 required positional argument: 'queries'

Fix Action

Fixed

PR fix notes

PR #4612: fix: validate tool kwargs even when empty to prevent cryptic TypeError (#4611)

Description (problem / solution / changelog)

fix: validate tool kwargs even when empty to prevent cryptic TypeError (#4611)

Summary

Fixes #4611RecallMemoryTool._run() missing 1 required positional argument: 'queries'.

Root cause: BaseTool._validate_kwargs had a if kwargs and ... guard that skipped schema validation when kwargs was an empty dict {}. In the native tool-calling path, if the LLM sends back empty or malformed arguments, tool.run(**{}) bypasses validation entirely, and _run() is called without required arguments — producing a confusing TypeError instead of a clear ValueError with field-level details.

Fix: Remove the kwargs truthiness check so args_schema.model_validate() always runs when a schema with fields is present. Add if not args: guards in run()/arun() to preserve backwards compatibility for positional-arg calls like tool.run("value").

Applied consistently to all 4 entry points: BaseTool.run, BaseTool.arun, Tool.run, Tool.arun.

Review & Testing Checklist for Human

  • Verify the if not args: guard is safe: When positional args are provided (tool.run("val")), kwargs validation is skipped. Confirm this doesn't allow invalid kwargs to slip through silently in any important code path (the native tool-calling path always uses kwargs, never positional args, so it should be fine).
  • Check for edge cases with tools that have no required fields: Tools with only optional/default fields should still work when called with tool.run()model_validate({}) should return defaults. Worth a quick manual check.
  • Run the full test suite to confirm no regressions beyond what was validated locally (the test_max_usage_count_is_respected VCR test was skipped locally due to missing API key).

Suggested test plan: Create a simple crew with memory=True, give the agent a task that would trigger memory search, and confirm it no longer crashes with the TypeError. The new unit tests cover the direct tool invocation path.

Notes

Changed files

  • lib/crewai/src/crewai/tools/base_tool.py (modified, +9/-5)
  • lib/crewai/tests/tools/test_base_tool.py (modified, +10/-0)
  • lib/crewai/tests/tools/test_memory_tools.py (added, +160/-0)

PR #4614: fix: validate tool kwargs even when empty to prevent cryptic TypeError

Description (problem / solution / changelog)

Summary

  • Fixes RecallMemoryTool._run() missing 1 required positional argument: 'queries' by ensuring BaseTool._validate_kwargs() runs even when kwargs is an empty dict
  • Adds if not args: guards so schema validation is skipped when positional args are used (backward compatibility)
  • Adds tests for the zero-args scenario on both sync and async paths

Closes #4611

Test plan

  • test_run_with_no_args_raises_validation_error — verifies ValueError instead of TypeError when calling run() with no args
  • test_arun_with_no_args_raises_validation_error — same for async path
  • All 30 existing test_base_tool.py tests pass

Changed files

  • lib/crewai/src/crewai/tools/base_tool.py (modified, +9/-6)
  • lib/crewai/tests/tools/test_base_tool.py (modified, +14/-0)

Code Example

from crewai import Agent, Crew, Process, Task, LLM
from crewai.project import CrewBase, agent, crew, task
from crewai.agents.agent_builder.base_agent import BaseAgent
from crewai_tools import FileReadTool
from typing import List
import os

# If you want to run a snippet of code before or after the crew starts,
# you can use the @before_kickoff and @after_kickoff decorators
# https://docs.crewai.com/concepts/crews#example-crew-class-with-decorators

@CrewBase
class ValkeyResearchDemo():
    """ValkeyResearchDemo crew"""

    agents: List[BaseAgent]
    tasks: List[Task]
    
    llm = LLM(
        model=os.getenv('MODEL'), 
        aws_region_name="us-east-2",
        aws_profile_name=os.getenv("AWS_PROFILE", "default"),  # Uses AWS CLI profile
        temperature=0.2,
        top_p=None
    )


    # Learn more about YAML configuration files here:
    # Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
    # Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
    
    # If you would like to add tools to your agents, you can learn more about it here:
    # https://docs.crewai.com/concepts/agents#agent-tools
    @agent
    def researcher(self) -> Agent:
        return Agent(
            config=self.agents_config['researcher'], # type: ignore[index]
            tools=[FileReadTool()],
            llm=self.llm,
            verbose=True
        )

    @agent
    def analyzer(self) -> Agent:
        return Agent(
            config=self.agents_config['analyzer'], # type: ignore[index]
            llm=self.llm,
            verbose=True
        )

    @agent
    def reporting_analyst(self) -> Agent:
        return Agent(
            config=self.agents_config['reporting_analyst'], # type: ignore[index]
            llm=self.llm,
            verbose=True
        )

    # To learn more about structured task outputs,
    # task dependencies, and task callbacks, check out the documentation:
    # https://docs.crewai.com/concepts/tasks#overview-of-a-task
    @task
    def research_task(self) -> Task:
        return Task(
            config=self.tasks_config['research_task'], # type: ignore[index]
        )

    @task
    def analysis_task(self) -> Task:
        return Task(
            config=self.tasks_config['analysis_task'], # type: ignore[index]
        )

    @task
    def reporting_task(self) -> Task:
        return Task(
            config=self.tasks_config['reporting_task'], # type: ignore[index]
            output_file='report.md'
        )

    @crew
    def crew(self) -> Crew:
        """Creates the ValkeyResearchDemo crew with LanceDB storage (testing without Valkey)"""
        from crewai.memory.storage.lancedb_storage import LanceDBStorage
        from crewai.memory import Memory
        
        # Use LanceDB storage (same backend as Valkey) with Bedrock embeddings
        lancedb_storage = LanceDBStorage(
            path="./lancedb_test"
        )
        
        # Wrap storage in Memory with embedder config
        memory = Memory(
            storage=lancedb_storage,
            llm=self.llm,
            embedder={
                "provider": "amazon-bedrock",
                "config": {"model": "amazon.titan-embed-text-v2:0"}
            }
        )
        
        print("✓ Using LanceDB storage with Bedrock embeddings (testing core crewai main branch)")
        
        return Crew(
            agents=self.agents, # Automatically created by the @agent decorator
            tasks=self.tasks, # Automatically created by the @task decorator
            process=Process.sequential,
            memory=memory,  # Use Memory with LanceDB storage
            llm=self.llm,
            verbose=True,
            # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
        )

---

researcher:
  role: >
    {topic} Senior Data Researcher
  goal: >
    Uncover cutting-edge developments in {topic}
  backstory: >
    You're a seasoned researcher with a knack for uncovering the latest
    developments in {topic}. Known for your ability to find the most relevant
    information and present it in a clear and concise manner.

analyzer:
  role: >
    {topic} Data Analyzer
  goal: >
    Analyze research findings and identify key patterns, trends, and insights about {topic}
  backstory: >
    You're an expert data analyst who excels at synthesizing complex information.
    You can quickly identify patterns, validate findings, and determine which
    insights are most valuable for decision-making.

reporting_analyst:
  role: >
    {topic} Reporting Analyst
  goal: >
    Create detailed reports based on {topic} data analysis and research findings
  backstory: >
    You're a meticulous analyst with a keen eye for detail. You're known for
    your ability to turn complex data into clear and concise reports, making
    it easy for others to understand and act on the information you provide.

---

researcher:
  role: >
    {topic} Senior Data Researcher
  goal: >
    Uncover cutting-edge developments in {topic}
  backstory: >
    You're a seasoned researcher with a knack for uncovering the latest
    developments in {topic}. Known for your ability to find the most relevant
    information and present it in a clear and concise manner.

analyzer:
  role: >
    {topic} Data Analyzer
  goal: >
    Analyze research findings and identify key patterns, trends, and insights about {topic}
  backstory: >
    You're an expert data analyst who excels at synthesizing complex information.
    You can quickly identify patterns, validate findings, and determine which
    insights are most valuable for decision-making.

reporting_analyst:
  role: >
    {topic} Reporting Analyst
  goal: >
    Create detailed reports based on {topic} data analysis and research findings
  backstory: >
    You're a meticulous analyst with a keen eye for detail. You're known for
    your ability to turn complex data into clear and concise reports, making
    it easy for others to understand and act on the information you provide.
RAW_BUFFERClick to expand / collapse

Description

I've got a simple crew running against the main branch. When I run it I'm seeing this error in the output: Tool search_memory executed with result: Error executing tool: RecallMemoryTool._run() missing 1 required positional argument: 'queries'... ╭──────────────────────────────────────────────────────────────────────────── 🔧 Tool Error (#1) ─────────────────────────────────────────────────────────────────────────────╮ │ │ │ Tool Failed │ │ Tool: search_memory │ │ Iteration: 1 │ │ Attempt: 0 │ │ Error: RecallMemoryTool._run() missing 1 required positional argument: 'queries'

Steps to Reproduce

Using the main branch, I've created a new crew.

from crewai import Agent, Crew, Process, Task, LLM
from crewai.project import CrewBase, agent, crew, task
from crewai.agents.agent_builder.base_agent import BaseAgent
from crewai_tools import FileReadTool
from typing import List
import os

# If you want to run a snippet of code before or after the crew starts,
# you can use the @before_kickoff and @after_kickoff decorators
# https://docs.crewai.com/concepts/crews#example-crew-class-with-decorators

@CrewBase
class ValkeyResearchDemo():
    """ValkeyResearchDemo crew"""

    agents: List[BaseAgent]
    tasks: List[Task]
    
    llm = LLM(
        model=os.getenv('MODEL'), 
        aws_region_name="us-east-2",
        aws_profile_name=os.getenv("AWS_PROFILE", "default"),  # Uses AWS CLI profile
        temperature=0.2,
        top_p=None
    )


    # Learn more about YAML configuration files here:
    # Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
    # Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
    
    # If you would like to add tools to your agents, you can learn more about it here:
    # https://docs.crewai.com/concepts/agents#agent-tools
    @agent
    def researcher(self) -> Agent:
        return Agent(
            config=self.agents_config['researcher'], # type: ignore[index]
            tools=[FileReadTool()],
            llm=self.llm,
            verbose=True
        )

    @agent
    def analyzer(self) -> Agent:
        return Agent(
            config=self.agents_config['analyzer'], # type: ignore[index]
            llm=self.llm,
            verbose=True
        )

    @agent
    def reporting_analyst(self) -> Agent:
        return Agent(
            config=self.agents_config['reporting_analyst'], # type: ignore[index]
            llm=self.llm,
            verbose=True
        )

    # To learn more about structured task outputs,
    # task dependencies, and task callbacks, check out the documentation:
    # https://docs.crewai.com/concepts/tasks#overview-of-a-task
    @task
    def research_task(self) -> Task:
        return Task(
            config=self.tasks_config['research_task'], # type: ignore[index]
        )

    @task
    def analysis_task(self) -> Task:
        return Task(
            config=self.tasks_config['analysis_task'], # type: ignore[index]
        )

    @task
    def reporting_task(self) -> Task:
        return Task(
            config=self.tasks_config['reporting_task'], # type: ignore[index]
            output_file='report.md'
        )

    @crew
    def crew(self) -> Crew:
        """Creates the ValkeyResearchDemo crew with LanceDB storage (testing without Valkey)"""
        from crewai.memory.storage.lancedb_storage import LanceDBStorage
        from crewai.memory import Memory
        
        # Use LanceDB storage (same backend as Valkey) with Bedrock embeddings
        lancedb_storage = LanceDBStorage(
            path="./lancedb_test"
        )
        
        # Wrap storage in Memory with embedder config
        memory = Memory(
            storage=lancedb_storage,
            llm=self.llm,
            embedder={
                "provider": "amazon-bedrock",
                "config": {"model": "amazon.titan-embed-text-v2:0"}
            }
        )
        
        print("✓ Using LanceDB storage with Bedrock embeddings (testing core crewai main branch)")
        
        return Crew(
            agents=self.agents, # Automatically created by the @agent decorator
            tasks=self.tasks, # Automatically created by the @task decorator
            process=Process.sequential,
            memory=memory,  # Use Memory with LanceDB storage
            llm=self.llm,
            verbose=True,
            # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
        )

With agents as

researcher:
  role: >
    {topic} Senior Data Researcher
  goal: >
    Uncover cutting-edge developments in {topic}
  backstory: >
    You're a seasoned researcher with a knack for uncovering the latest
    developments in {topic}. Known for your ability to find the most relevant
    information and present it in a clear and concise manner.

analyzer:
  role: >
    {topic} Data Analyzer
  goal: >
    Analyze research findings and identify key patterns, trends, and insights about {topic}
  backstory: >
    You're an expert data analyst who excels at synthesizing complex information.
    You can quickly identify patterns, validate findings, and determine which
    insights are most valuable for decision-making.

reporting_analyst:
  role: >
    {topic} Reporting Analyst
  goal: >
    Create detailed reports based on {topic} data analysis and research findings
  backstory: >
    You're a meticulous analyst with a keen eye for detail. You're known for
    your ability to turn complex data into clear and concise reports, making
    it easy for others to understand and act on the information you provide.

and tasks as

researcher:
  role: >
    {topic} Senior Data Researcher
  goal: >
    Uncover cutting-edge developments in {topic}
  backstory: >
    You're a seasoned researcher with a knack for uncovering the latest
    developments in {topic}. Known for your ability to find the most relevant
    information and present it in a clear and concise manner.

analyzer:
  role: >
    {topic} Data Analyzer
  goal: >
    Analyze research findings and identify key patterns, trends, and insights about {topic}
  backstory: >
    You're an expert data analyst who excels at synthesizing complex information.
    You can quickly identify patterns, validate findings, and determine which
    insights are most valuable for decision-making.

reporting_analyst:
  role: >
    {topic} Reporting Analyst
  goal: >
    Create detailed reports based on {topic} data analysis and research findings
  backstory: >
    You're a meticulous analyst with a keen eye for detail. You're known for
    your ability to turn complex data into clear and concise reports, making
    it easy for others to understand and act on the information you provide.

This crew references my local copy of the main branch, not a released version

I run crewai run and all my search_memory tools generate the error Tool search_memory executed with result: Error executing tool: RecallMemoryTool._run() missing 1 required positional argument: 'queries'...

Expected behavior

I expect there to be no error

Screenshots/Code snippets

<img width="1243" height="635" alt="Image" src="https://github.com/user-attachments/assets/55357406-39b9-40c4-9432-9f75a8a2c3b1" />

Operating System

Other (specify in additional context)

Python Version

3.11

crewAI Version

main branch - still happening as of commit 09e3b81ca39ba113187080f5a0fb8a2560fe5448

crewAI Tools Version

main branch, commit 09e3b81ca39ba113187080f5a0fb8a2560fe5448

Virtual Environment

Venv

Evidence

<img width="1239" height="262" alt="Image" src="https://github.com/user-attachments/assets/08f0425c-0599-458c-9776-7045d9bd9e05" />

Possible Solution

None

Additional context

MacOs Tahoe,

I'm working on building a valkey implementation of the new Storage Backend and working on testing it to make sure it works. This example code is using lancedb instead to simplify the crew to reproduce the error - though I was getting it in my valkey-supported version. The error occurs with both the main branch and my feature branch , which suggests it is unrelated to my feature branch. I know that this is bleeding edge. I'm wondering if this is a known issue with a timeline, or a not-yet known issue.

extent analysis

Fix Plan

The error RecallMemoryTool._run() missing 1 required positional argument: 'queries' indicates that the RecallMemoryTool is missing a required argument queries.

To fix this issue, you need to pass the queries argument to the RecallMemoryTool.

Here are the steps to fix the issue:

  • Check the search_memory tool configuration and ensure that it includes the queries argument.
  • If the queries argument is not provided, you need to modify the tool configuration to include it.

Example code snippet:

@task
def research_task(self) -> Task:
    return Task(
        config=self.tasks_config['research_task'], 
        tools=[RecallMemoryTool(queries=["query1", "query2"])] # Pass queries argument
    )

Alternatively, you can modify the RecallMemoryTool to provide a default value for the queries argument if it is not provided.

Verification

To verify that the fix worked, run the crew again using crewai run and check the output for any errors related to the RecallMemoryTool. If the error is resolved, the crew should run without any issues.

Extra Tips

  • Ensure that the queries argument is correctly formatted and passed to the RecallMemoryTool.
  • If you are using a custom implementation of the RecallMemoryTool, ensure that it is correctly handling the queries argument.
  • Check the crewai documentation for any updates or changes to the RecallMemoryTool configuration.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

I expect there to be no error

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

crewai - ✅(Solved) Fix [BUG] Recall Memory Tool fails with missing required positional argument [2 pull requests, 1 participants]