{"record":{"id":"b3a4b445665094a9","repo":"microsoft/graphrag","slug":"table-table-name-not-found-in-namespace-self","errorCode":null,"errorMessage":"Table '{table_name}' not found in namespace '{self._namespace}'.","messagePattern":"Table '(.+?)' not found in namespace '(.+?)'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-storage/graphrag_storage/tables/cosmos_table_provider.py","lineNumber":187,"sourceCode":"            async for doc in page:\n                docs.append(_strip_cosmos_metadata(doc))  # noqa: PERF401\n\n        if docs:\n            return pd.DataFrame(docs)\n\n        # ---- Legacy fallback (optional) --------------------------------\n        if self._legacy_container is not None:\n            df = await self._read_legacy_table(table_name)\n            if df is not None and not df.empty:\n                logger.warning(\n                    \"Reading '%s' from legacy container — run \"\n                    \"'graphrag migrate-cosmos' to complete migration.\",\n                    table_name,\n                )\n                return df\n\n        msg = f\"Table '{table_name}' not found in namespace '{self._namespace}'.\"\n        raise ValueError(msg)\n\n    async def write_dataframe(self, table_name: str, df: pd.DataFrame) -> None:\n        \"\"\"Write *df* as documents, replacing any existing rows for this table.\"\"\"\n        container = await self._ensure_container()\n\n        # Delete existing documents for this table in the namespace.\n        await self._delete_table(container, table_name)\n\n        records = json.loads(\n            df.to_json(orient=\"records\", lines=False, force_ascii=False)\n        )\n        docs = []\n        for index, row in enumerate(records):\n            row_key = row.pop(\"id\", index)\n            doc = {\n                \"id\": f\"{table_name}:{row_key}\",\n                \"namespace\": self._namespace,\n                \"table_name\": table_name,","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-storage/graphrag_storage/tables/cosmos_table_provider.py#L169-L205","documentation":"CosmosTableProvider.read_dataframe queries documents whose table field matches table_name within the provider's namespace; if no documents match (and no legacy-migration path applies), the table simply does not exist and a ValueError is raised rather than returning an empty frame silently. The earlier branch returns a df when a legacy table is detected and a migration hint is logged.","triggerScenarios":"Awaiting read_dataframe('create_base_entities') (or any output table) before the indexing pipeline has produced it, or with a different namespace/container than the one the outputs were written to.","commonSituations":"Running update/query against a fresh or wrong database; namespace mismatch after changing container_name or the namespace config; querying a table name that was renamed between GraphRAG versions.","solutions":["Run (or re-run) the indexing pipeline so outputs are written before reading","Verify database_name/container_name/namespace match the ones used at write time","Check for typos in table_name against the pipeline's output table list"],"exampleFix":"# before\ndf = await provider.read_dataframe(\"create_base_entities\")\n# after\n# index first: python -m graphrag index --root .\ndf = await provider.read_dataframe(\"create_base_entities\")","handlingStrategy":"try-catch","validationCode":"existing = {t for t in expected_tables if await provider.has_table(t)} if hasattr(provider, \"has_table\") else None","typeGuard":null,"tryCatchPattern":"try:\n    df = await provider.read_dataframe(name)\nexcept ValueError as e:\n    if \"not found in namespace\" in str(e):\n        logger.warning(\"table %s missing; run indexing first\", name)\n        df = None\n    else:\n        raise","preventionTips":["Gate query/update flows on an indexing-completion marker","Pin database/container/namespace in one shared config"],"tags":["cosmosdb","table-provider","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}