{"record":{"id":"02b047237c1a0078","repo":"crewAIInc/crewAI","slug":"table-table-does-not-exist-in-the-database-plea","errorCode":null,"errorMessage":"Table {table} does not exist in the database. Please ensure the table is created.","messagePattern":"Table (.+?) does not exist in the database\\. Please ensure the table is created\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/singlestore_search_tool/singlestore_search_tool.py","lineNumber":304,"sourceCode":"        conn = self._get_connection()\n        try:\n            with conn.cursor() as cursor:\n                cursor.execute(\"SHOW TABLES\")\n                existing_tables = {table[0] for table in cursor.fetchall()}\n\n                if not existing_tables or len(existing_tables) == 0:\n                    raise ValueError(\n                        \"No tables found in the database. \"\n                        \"Please ensure the database is initialized with the required tables.\"\n                    )\n\n                if not tables or len(tables) == 0:\n                    tables = list(existing_tables)\n\n                table_definitions = []\n                for table in tables:\n                    if table not in existing_tables:\n                        raise ValueError(\n                            f\"Table {table} does not exist in the database. \"\n                            f\"Please ensure the table is created.\"\n                        )\n\n                    cursor.execute(f\"SHOW COLUMNS FROM {table}\")\n                    columns = cursor.fetchall()\n                    column_info = \", \".join(f\"{row[0]} {row[1]}\" for row in columns)\n                    table_definitions.append(f\"{table}({column_info})\")\n        finally:\n            # Ensure the connection is returned to the pool\n            conn.close()\n\n        self.description = (\n            f\"A tool that can be used to semantic search a query from a SingleStore \"\n            f\"database's {', '.join(table_definitions)} table(s) content.\"\n        )\n        self._generate_description()\n","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/singlestore_search_tool/singlestore_search_tool.py#L286-L322","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\ntool = SingleStoreSearchTool(..., tables=[\"sales_facts\"])\n\n# after\ntool = SingleStoreSearchTool(..., tables=[\"fact_sales\"])  # name from SHOW TABLES","handlingStrategy":"validation","validationCode":"conn = singlestore.connect(**conn_args)\nwith conn.cursor() as cur:\n    cur.execute(\"SHOW TABLES\")\n    existing = {r[0] for r in cur.fetchall()}\nmissing = [t for t in requested_tables if t not in existing]\nif missing:\n    raise ValueError(f\"Tables not found: {missing}; available: {sorted(existing)}\")\nconn.close()","typeGuard":null,"tryCatchPattern":"try:\n    defs = tool._validate_tables(requested_tables)\nexcept ValueError as e:\n    if \"does not exist\" in str(e):\n        # reconcile against SHOW TABLES and correct config\n        raise","preventionTips":["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."],"tags":["singlestore","database","table-not-found","validation"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}