{"record":{"id":"bdae459387e183f9","repo":"infiniflow/ragflow","slug":"dataset-id-not-found","errorCode":null,"errorMessage":"dataset({id}) not found.","messagePattern":"dataset\\((.+?)\\) not found\\.","errorType":"exception","errorClass":"LookupError","httpStatus":null,"severity":"error","filePath":"api/db/services/knowledgebase_service.py","lineNumber":414,"sourceCode":"                    continue\n                if isinstance(v, dict):\n                    assert isinstance(old[k], dict)\n                    dfs_update(old[k], v)\n                elif isinstance(v, list):\n                    assert isinstance(old[k], list)\n                    old[k] = list(set(old[k] + v))\n                else:\n                    old[k] = v\n\n        dfs_update(m.parser_config, config)\n        cls.update_by_id(id, {\"parser_config\": m.parser_config})\n\n    @classmethod\n    @DB.connection_context()\n    def delete_field_map(cls, id):\n        e, m = cls.get_by_id(id)\n        if not e:\n            raise LookupError(f\"dataset({id}) not found.\")\n\n        m.parser_config.pop(\"field_map\", None)\n        cls.update_by_id(id, {\"parser_config\": m.parser_config})\n\n    @classmethod\n    @DB.connection_context()\n    def get_field_map(cls, ids):\n        # Get field mappings for knowledge bases\n        # Args:\n        #     ids: List of dataset IDs\n        # Returns:\n        #     Dictionary of field mappings\n        conf = {}\n        for k in cls.get_by_ids(ids):\n            if k.parser_config and \"field_map\" in k.parser_config:\n                conf.update(k.parser_config[\"field_map\"])\n        return conf\n","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/db/services/knowledgebase_service.py#L396-L432","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nKBService.delete_field_map(kb_id)\n\n# after\nok, kb = KBService.get_by_id(kb_id)\nif not ok:\n    abort(404, 'dataset not found')\nKBService.delete_field_map(kb_id)","handlingStrategy":"validation","validationCode":"ok, kb = KBService.get_by_id(kb_id)\nif not ok:\n    return json_error_response('dataset not found', 404)","typeGuard":null,"tryCatchPattern":"try:\n    KBService.delete_field_map(kb_id)\nexcept LookupError:\n    return json_error_response('dataset not found', 404)","preventionTips":["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."],"tags":["not-found","knowledgebase","field-map","lookup-error"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}