crewAIInc/crewAI · error · ValueError
Table {table} does not exist in the database. Please ensure
Error message
Table {table} does not exist in the database. Please ensure the table is created. What it means
SingleStoreSearchTool cross-checks each requested table name against the output of SHOW TABLES; if a table in the `tables` list is not found, it raises ValueError naming the missing table. This runs during table-definition building, after the 'no tables' check has passed.
Source
Thrown at lib/crewai-tools/src/crewai_tools/tools/singlestore_search_tool/singlestore_search_tool.py:304
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)
table_definitions.append(f"{table}({column_info})")
finally:
# Ensure the connection is returned to the pool
conn.close()
self.description = (
f"A tool that can be used to semantic search a query from a SingleStore "
f"database's {', '.join(table_definitions)} table(s) content."
)
self._generate_description()
View on GitHub (pinned to 754d7323be)
Solutions
- Run SHOW TABLES on the connected database and correct the table names in your `tables` argument to match exactly.
- Confirm the `database` parameter points at the database that actually contains those tables.
- Omit the tables argument entirely — the tool then defaults to using all existing tables.
Example fix
# before tool = SingleStoreSearchTool(..., tables=["sales_facts"]) # after tool = SingleStoreSearchTool(..., tables=["fact_sales"]) # name from SHOW TABLES
Defensive patterns
Strategy: validation
Validate before calling
conn = singlestore.connect(**conn_args)
with conn.cursor() as cur:
cur.execute("SHOW TABLES")
existing = {r[0] for r in cur.fetchall()}
missing = [t for t in requested_tables if t not in existing]
if missing:
raise ValueError(f"Tables not found: {missing}; available: {sorted(existing)}")
conn.close() Try / catch
try:
defs = tool._validate_tables(requested_tables)
except ValueError as e:
if "does not exist" in str(e):
# reconcile against SHOW TABLES and correct config
raise Prevention
- Validate configured table names against SHOW TABLES at startup, per environment.
- Omit the tables argument to let the tool adopt all existing tables when exact names may drift.
When it happens
Trigger: Passing tables=["sales_facts"] when the database contains e.g. fact_sales; case-sensitivity mismatches on table names; tables listed in configuration that were renamed or dropped; environment drift (staging table names differing from production).
Common situations: Config copied between environments with different schemas; tables renamed during a migration but the tool config not updated; wrong database selected so every listed table appears missing.
Related errors
- No tables found in the database. Please ensure the database
- Project name cannot be empty
- Project name '{name}' produces invalid folder name '{folder_
- Database URI is required for MySQL loader
- Invalid MySQL URI scheme: {parsed.scheme}
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/02b047237c1a0078.
Report an issue: GitHub.