crewAIInc/crewAI · error · ValueError

No tables found in the database. Please ensure the database

Error message

No tables found in the database. Please ensure the database is initialized with the required tables.

What it means

SingleStoreSearchTool validates the target database before use: it runs SHOW TABLES and raises ValueError when the result set is empty. This means the connection succeeded but the database (or schema) contains zero tables, so there is nothing to derive table definitions from for the LLM's SQL generation.

Source

Thrown at lib/crewai-tools/src/crewai_tools/tools/singlestore_search_tool/singlestore_search_tool.py:293

        self._initialize_tables(tables)

    def _initialize_tables(self, tables: list[str]) -> None:
        """Initialize and validate the tables that this tool will work with.

        Args:
            tables: List of table names to validate and use

        Raises:
            ValueError: If no tables exist or specified tables don't exist
        """
        conn = self._get_connection()
        try:
            with conn.cursor() as cursor:
                cursor.execute("SHOW TABLES")
                existing_tables = {table[0] for table in cursor.fetchall()}

                if not existing_tables or len(existing_tables) == 0:
                    raise ValueError(
                        "No tables found in the database. "
                        "Please ensure the database is initialized with the required tables."
                    )

                if not tables or len(tables) == 0:
                    tables = list(existing_tables)

                table_definitions = []
                for table in tables:
                    if table not in existing_tables:
                        raise ValueError(
                            f"Table {table} does not exist in the database. "
                            f"Please ensure the table is created."
                        )

                    cursor.execute(f"SHOW COLUMNS FROM {table}")
                    columns = cursor.fetchall()
                    column_info = ", ".join(f"{row[0]} {row[1]}" for row in columns)

View on GitHub (pinned to 754d7323be)

Solutions

  1. Verify the database name in the tool configuration matches the one containing your tables.
  2. Initialize the database with your schema (run CREATE TABLE / migrations) and retry.
  3. Check the connecting user has SELECT/SHOW privileges on the intended tables.
Defensive patterns

Strategy: validation

Validate before calling

conn = singlestore.connect(**conn_args)
with conn.cursor() as cur:
    cur.execute("SHOW TABLES")
    if not cur.fetchall():
        raise RuntimeError("Target database is empty; run migrations before use")
conn.close()

Try / catch

try:
    tool = SingleStoreSearchTool(...)
except ValueError as e:
    if "No tables found" in str(e):
        # wrong database name or schema not provisioned
        raise

Prevention

When it happens

Trigger: Connecting with database= pointing at a fresh/empty database; connecting to the wrong database name; a user whose privileges hide all tables; specifying a schema scope where no tables exist.

Common situations: Typos in the database parameter; forgetting to run migrations/setup scripts that create the tables; using a shared SingleStore workspace and landing in its empty default database.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/344e72786f241b56. Report an issue: GitHub.