{"record":{"id":"49e63fed4c51451a","repo":"666ghj/MiroFish","slug":"batch-create-returned-no-batch-id","errorCode":null,"errorMessage":"batch.create returned no batch_id","messagePattern":"batch\\.create returned no batch_id","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"backend/scripts/validate_zep_cloud_integration.py","lineNumber":517,"sourceCode":"                \"error_type\": type(error).__name__,\n                \"status_code\": _status_code(error),\n            }\n            raise\n\n        builder.set_ontology(graph_id, ONTOLOGY)\n        print(\"[zep-deep] ontology set\", flush=True)\n\n        operation_id = f\"deep-validation-{stamp}\"\n        batch = client.batch.create(\n            metadata={\n                \"mirofish_operation_id\": operation_id,\n                \"graph_id\": graph_id,\n                \"suite\": \"zep_deep_validation\",\n            }\n        )\n        batch_id = batch.batch_id\n        if not batch_id:\n            raise RuntimeError(\"batch.create returned no batch_id\")\n        result[\"batch_id\"] = batch_id\n\n        added_details: list[Any] = []\n        batch_items = [\n            _episode_to_batch_item(graph_id, item, index)\n            for index, item in enumerate(BASELINE_EPISODES)\n        ]\n        for start in range(0, len(batch_items), 4):\n            added_details.extend(\n                client.batch.add(batch_id=batch_id, items=batch_items[start : start + 4])\n            )\n        client.batch.process(batch_id=batch_id)\n        print(f\"[zep-deep] batch submitted items={len(batch_items)}\", flush=True)\n\n        submission = BatchSubmission(\n            batch_id=batch_id,\n            operation_id=operation_id,\n            episode_uuids=[_uuid(item) for item in added_details if _uuid(item)],","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/666ghj/MiroFish/blob/b5b53acc57189a4a42e44a23e149dc655c98fe82/backend/scripts/validate_zep_cloud_integration.py#L499-L535","documentation":"Raised in the validation script's main flow when client.batch.create succeeds but batch.batch_id is falsy. Without a batch_id the script cannot add items, process, or list the batch, so it aborts immediately. It is a RuntimeError guarding an unexpected SDK/API response shape.","triggerScenarios":"client.batch.create(metadata=...) returning a response with a None/empty batch_id — SDK-API version mismatch after upgrading zep-cloud, a renamed field, or a stubbed client in tests.","commonSituations":"zep-cloud SDK upgraded beyond the API's response format (or vice versa); partially mocked clients in CI constructing a Batch without batch_id.","solutions":["Align the zep-cloud package version with the API (upgrade to latest, or pin a known-good release).","Debug once by printing type(batch) and vars(batch) to spot renamed fields.","If mocking, make the fake batch.create return an object with a non-empty batch_id."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def batch_has_id(batch: Any) -> bool:\n    return bool(getattr(batch, \"batch_id\", None))","tryCatchPattern":"try:\n    batch = client.batch.create(metadata=meta)\n    if not batch.batch_id:\n        raise RuntimeError(\"batch.create returned no batch_id\")\nexcept RuntimeError as e:\n    if \"no batch_id\" in str(e):\n        logger.error(\"zep-cloud response shape changed; check SDK version\")\n        raise\n    raise","preventionTips":["Lock the zep-cloud SDK version and re-run the validation suite on every upgrade.","Inspect the raw response object once when this fires to spot renamed fields early.","Make mocked batch.create return a batch_id in tests."],"tags":["zep","batch-api","sdk-compatibility","api-contract","runtime"],"backgroundTag":null,"analyzedSha":"b5b53acc57189a4a42e44a23e149dc655c98fe82","analyzedAt":"2026-08-14T22:29:33.146Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}