iflytek/astron-agent · error · ValueError
Dataset ' ' (id= ) not visible to ragflow_sdk
Error message
Dataset '{group_name}' (id={actual_id}) not visible to ragflow_sdk What it means
Raised after the REST API resolved the dataset id, but the ragflow_sdk list_datasets(id=...) call returned nothing. REST and SDK layers disagree: the SDK session cannot see the dataset the REST API reported.
Solutions
- Verify the SDK and REST paths use the same API key and base URL configuration.
- Run rag.list_datasets() without filters via SDK and confirm the dataset id appears in the results.
- Align the ragflow-sdk package version with the RAGFlow server version.
- Re-run the request; if transient, check for concurrent deletions or replication lag on the RAGFlow side.
Example fix
# before: assume SDK honors id filter
sdk_datasets = rag.list_datasets(id=actual_id)
# after: diagnose disagreement
sdk_datasets = rag.list_datasets(id=actual_id)
if not sdk_datasets:
all_ids = [d.id for d in rag.list_datasets()]
logger.error(f"SDK sees datasets {all_ids}; REST returned id={actual_id}") Defensive patterns
Strategy: retry
Validate before calling
def same_creds() -> bool:
return (os.getenv("RAGFLOW_API_KEY") == os.getenv("RAGFLOW_SDK_API_KEY") and
os.getenv("RAGFLOW_API_BASE") == os.getenv("RAGFLOW_SDK_BASE")) Try / catch
try:
doc = await upload_document_to_dataset(content, filename)
except ValueError as e:
if "not visible to ragflow_sdk" in str(e):
logger.error("REST/SDK dataset visibility mismatch — check SDK config/version", e)
raise Prevention
- Use a single configuration object for both REST and SDK paths
- Keep ragflow-sdk version aligned with the server via dependency pinning
- Add an integration test resolving a dataset via both REST and SDK
When it happens
Trigger: SDK initialized with a different API key/base URL than the REST client; dataset deleted between the REST and SDK calls; SDK version incompatible with the RAGFlow server (id filtering not honored); tenant/permission mismatch.
Common situations: Split configuration where RAGFLOW_API_BASE differs between SDK and REST settings; RAGFlow server upgraded while the pinned ragflow-sdk is stale; concurrent dataset deletion during upload.
Related errors
- fetch_all_document_chunks: empty page
- REPO_CREATE_RAGFLOW_FAILED
- REPO_STATUS_ILLEGAL
- REPO_KNOWLEDGE_ADD_FAILED
- REPO_KNOWLEDGE_MODIFY_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/0b42b49581ee9a5a.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/ragflow/ragflow_client.py:546
return await _upload_via_default_group(file_content=file_content, filename=filename)
async def _resolve_dataset_via_rest(group_name: str, rag: Any) -> Any:
"""Fallback: locate default-group dataset via REST when SDK name lookup fails.
Kept separate to avoid increasing default-group path complexity.
"""
rest_response = await list_datasets(name=group_name)
datasets = rest_response.get("data", []) if rest_response else []
if not datasets:
raise ValueError(f"Dataset '{group_name}' does not exist in RAGFlow")
actual_id = datasets[0].get("id")
if not actual_id:
raise ValueError(f"Dataset '{group_name}' REST response missing id field")
sdk_datasets: List[Any] = rag.list_datasets(id=actual_id)
if not sdk_datasets:
raise ValueError(
f"Dataset '{group_name}' (id={actual_id}) not visible to ragflow_sdk"
)
return sdk_datasets[0]
async def _upload_via_default_group(file_content: bytes, filename: str) -> List[Any]:
"""Legacy upload path using configured ``RAGFLOW_DEFAULT_GROUP``.
Kept separate to avoid increasing ``upload_document_to_dataset`` complexity.
"""
group_name = _config_value("default_group", "RAGFLOW_DEFAULT_GROUP", "")
if not group_name:
raise ValueError(
"RAGFLOW_DEFAULT_GROUP is not set; cannot upload without dataset_id"
)
rag = get_rag_object()
sdk_hit: List[Any] = rag.list_datasets(name=group_name)View on GitHub (pinned to 5e758547a8)