{"record":{"id":"641f9089fbc564c0","repo":"HKUDS/DeepTutor","slug":"pageindex-submit-document-returned-no-doc-id-res","errorCode":null,"errorMessage":"PageIndex submit_document returned no doc_id: {result!r}","messagePattern":"PageIndex submit_document returned no doc_id: (.+?)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/rag/pipelines/pageindex/client.py","lineNumber":135,"sourceCode":"            )\n        )\n\n    @classmethod\n    def local_read(cls, storage_path: str | Path) -> \"PageIndexClient\":\n        \"\"\"Open an existing Local Library without resolving indexing credentials.\"\"\"\n        _, local_type = _sdk_types()\n        return cls(local_type(storage_path=str(storage_path)))\n\n    async def submit_document(self, file_path: str | Path, *, mode: str | None = None) -> str:\n        result = await asyncio.to_thread(\n            self.sdk_client.submit_document,\n            str(file_path),\n            mode=mode,\n            wait=True,\n        )\n        doc_id = result.get(\"doc_id\") if isinstance(result, dict) else None\n        if not doc_id:\n            raise RuntimeError(f\"PageIndex submit_document returned no doc_id: {result!r}\")\n        return str(doc_id)\n\n    async def delete_document(self, doc_id: str) -> bool:\n        await asyncio.to_thread(self.sdk_client.delete_document, doc_id)\n        return True\n\n\n__all__ = [\n    \"PageIndexClient\",\n    \"resolve_oss_sdk_config\",\n]\n","sourceCodeStart":117,"sourceCodeEnd":147,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/rag/pipelines/pageindex/client.py#L117-L147","documentation":"submit_document calls the PageIndex SDK with wait=True and expects a dict containing a doc_id. If the result isn't a dict or doc_id is empty/missing, ingestion can't proceed so a RuntimeError with the repr of the result is raised.","triggerScenarios":"Calling _ingest → submit_document where the PageIndex SDK returns None, an error payload without doc_id, an empty dict, or a non-dict (string/list) response.","commonSituations":"PageIndex OSS server version mismatch returning a differently-shaped response, server-side ingestion failure swallowed into a status payload, or transient API error bodies; also SDK upgrades that rename the id field.","solutions":["Inspect the repr in the error to see what the server actually returned; if it's an error payload, address the server-side cause.","Update the pageindex SDK / OSS server to matched versions so submit_document returns {\"doc_id\": ...}.","Retry the submission once — transient server hiccups can produce empty results; if it persists, check OSS server logs."],"exampleFix":"# before\ndoc_id = await client.submit_document(file_path)  # RuntimeError: no doc_id\n\n# after\nresult = await client.sdk_client.upload_document(str(file_path), mode=mode, wait=True)\nif not (isinstance(result, dict) and result.get(\"doc_id\")):\n    logger.error(\"unexpected PageIndex response: %r\", result)\n    raise RuntimeError(f\"PageIndex submit_document returned no doc_id: {result!r}\")","handlingStrategy":"retry","validationCode":"result = await client.sdk_client.upload_document(str(f), mode=mode, wait=True)\nassert isinstance(result, dict) and result.get(\"doc_id\"), f\"bad response: {result!r}\"","typeGuard":"def is_valid_submit_result(result) -> bool:\n    return isinstance(result, dict) and bool(result.get(\"doc_id\"))","tryCatchPattern":"for attempt in range(2):\n    try:\n        return await client.submit_document(file_path)\n    except RuntimeError as e:\n        if \"no doc_id\" in str(e) and attempt == 0:\n            await asyncio.sleep(2)\n            continue\n        raise","preventionTips":["Pin matched OSS server and SDK versions.","Log full SDK responses during ingestion debugging.","Health-check the PageIndex OSS service before batch ingest.","Validate response shape immediately rather than downstream."],"tags":["pageindex","ingestion","api-response","sdk"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}