{"record":{"id":"c95cc44eb9cce0af","repo":"666ghj/MiroFish","slug":"error","errorCode":null,"errorMessage":"没有找到符合条件的实体，请检查图谱是否正确构建","messagePattern":"没有找到符合条件的实体，请检查图谱是否正确构建","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/app/services/simulation_manager.py","lineNumber":320,"sourceCode":"                enrich_with_edges=True\n            )\n            \n            state.entities_count = filtered.filtered_count\n            state.entity_types = list(filtered.entity_types)\n            \n            if progress_callback:\n                progress_callback(\n                    \"reading\", 100,\n                    t('progress.readingComplete', count=filtered.filtered_count),\n                    current=filtered.filtered_count,\n                    total=filtered.filtered_count\n                )\n            \n            if filtered.filtered_count == 0:\n                state.status = SimulationStatus.FAILED\n                state.error = \"没有找到符合条件的实体，请检查图谱是否正确构建\"\n                self._save_simulation_state(state)\n                raise ValueError(state.error)\n            \n            # ========== 阶段2: 生成Agent Profile ==========\n            total_entities = len(filtered.entities)\n            \n            if progress_callback:\n                progress_callback(\n                    \"generating_profiles\", 0,\n                    t('progress.startGenerating'),\n                    current=0,\n                    total=total_entities\n                )\n            \n            # 传入graph_id以启用Zep检索功能，获取更丰富的上下文\n            generator = OasisProfileGenerator(graph_id=state.graph_id)\n            \n            def profile_progress(current, total, msg):\n                if progress_callback:\n                    progress_callback(","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/666ghj/MiroFish/blob/b5b53acc57189a4a42e44a23e149dc655c98fe82/backend/app/services/simulation_manager.py#L302-L338","documentation":"Raised in SimulationManager.prepare_simulation stage 1: after reading entities from the graph and applying filters, filtered.filtered_count == 0, so there is nothing to build agent profiles from. The state is persisted as FAILED with this message and a ValueError is raised. It means the knowledge graph either lacks usable entity nodes or none survive the filter criteria.","triggerScenarios":"Graph not built yet or built into a different graph_id than the one queried; all entities filtered out because they lack required attributes/labels; entity types in the graph don't match defined_entity_types; Zep read returned empty due to wrong graph id or permissions.","commonSituations":"User skips graph construction and jumps to simulation; ontology entity type names drifted between generation and filtering (case/singular-plural); graph built but extraction produced no entities (see errors 23-25); querying the wrong/empty Zep graph.","solutions":["Confirm the graph exists and has entities: inspect the Zep graph for the project's graph_id before preparing.","Rebuild the graph (document ingestion + ontology) and verify entity extraction produced nodes.","Align defined_entity_types with the actual labels in the graph (exact names, casing) or relax the filter.","Check the filter implementation for over-restrictive conditions (required fields most entities don't have)."],"exampleFix":"# before\nmanager.prepare_simulation(sim_id, project_id, graph_id='empty-graph', ...)\n# after\n# verify graph has usable entities first\nentities = builder.get_entities_for_simulation(graph_id)\nassert entities, 'graph has no entities; rebuild graph before prepare'\nmanager.prepare_simulation(sim_id, project_id, graph_id=graph_id, ...)","handlingStrategy":"validation","validationCode":"entities = builder.get_entities_for_simulation(graph_id)\nif not entities:\n    raise ValueError('graph has no usable entities; run graph construction first')\nmanager.prepare_simulation(sim_id, project_id, graph_id=graph_id, ...)","typeGuard":null,"tryCatchPattern":"try:\n    state = manager.prepare_simulation(sim_id, ...)\nexcept ValueError as e:\n    if '没有找到符合条件的实体' in str(e):\n        # state is already FAILED; guide user to rebuild graph or relax filters\n        return error_response('rebuild the graph or widen entity filters')\n    raise","preventionTips":["Verify the graph has entities before exposing the 'create simulation' action.","Keep ontology entity type names consistent between generation and filtering.","Log filtered vs total entity counts during prepare to diagnose over-filtering."],"tags":["simulation","graph","empty-result","filtering","zep"],"backgroundTag":null,"analyzedSha":"b5b53acc57189a4a42e44a23e149dc655c98fe82","analyzedAt":"2026-08-14T22:29:33.146Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}