infiniflow/ragflow · error · LookupError
dataset({id}) not found.
Error message
dataset({id}) not found. What it means
Raised by KBService.delete_field_map when get_by_id(id) does not find the knowledge base (dataset). Before dropping the 'field_map' key from parser_config, the service verifies the dataset exists; a missing row raises this LookupError.
Source
Thrown at api/db/services/knowledgebase_service.py:414
continue
if isinstance(v, dict):
assert isinstance(old[k], dict)
dfs_update(old[k], v)
elif isinstance(v, list):
assert isinstance(old[k], list)
old[k] = list(set(old[k] + v))
else:
old[k] = v
dfs_update(m.parser_config, config)
cls.update_by_id(id, {"parser_config": m.parser_config})
@classmethod
@DB.connection_context()
def delete_field_map(cls, id):
e, m = cls.get_by_id(id)
if not e:
raise LookupError(f"dataset({id}) not found.")
m.parser_config.pop("field_map", None)
cls.update_by_id(id, {"parser_config": m.parser_config})
@classmethod
@DB.connection_context()
def get_field_map(cls, ids):
# Get field mappings for knowledge bases
# Args:
# ids: List of dataset IDs
# Returns:
# Dictionary of field mappings
conf = {}
for k in cls.get_by_ids(ids):
if k.parser_config and "field_map" in k.parser_config:
conf.update(k.parser_config["field_map"])
return conf
View on GitHub (pinned to 554fb1133a)
Solutions
- Verify the id via the dataset list API before calling delete_field_map.
- Refresh the client's dataset reference if the dataset was deleted; recreate it if needed.
- Treat LookupError with 'not found' as a 404 and make the client operation idempotent.
- Check the kb table (SELECT id FROM knowledgebase WHERE id = ...) to confirm the row exists.
Example fix
# before
KBService.delete_field_map(kb_id)
# after
ok, kb = KBService.get_by_id(kb_id)
if not ok:
abort(404, 'dataset not found')
KBService.delete_field_map(kb_id) Defensive patterns
Strategy: validation
Validate before calling
ok, kb = KBService.get_by_id(kb_id)
if not ok:
return json_error_response('dataset not found', 404) Try / catch
try:
KBService.delete_field_map(kb_id)
except LookupError:
return json_error_response('dataset not found', 404) Prevention
- Load fresh dataset state before editing its field map.
- Handle 404 as idempotent removal when the dataset is already gone.
- Never persist kb ids across environment resets.
When it happens
Trigger: Calling the dataset field-map delete endpoint/API with a kb id that was deleted, never existed, or is typo'd; concurrent dataset deletion racing the field-map update.
Common situations: Stale dataset id kept in a client session; scripts running against the wrong environment's ids; deleting a dataset in one tab while its settings dialog is open in another.
Related errors
- Tenant not found
- main() returned a non-JSON-serializable value.
- Repository or path not found. Please check the URL and ensur
- User '{username}' not found
- 404
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/bdae459387e183f9.
Report an issue: GitHub.