666ghj/MiroFish · error · ValueError

没有找到符合条件的实体,请检查图谱是否正确构建

Error message

没有找到符合条件的实体,请检查图谱是否正确构建

What it means

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.

Source

Thrown at backend/app/services/simulation_manager.py:320

                enrich_with_edges=True
            )
            
            state.entities_count = filtered.filtered_count
            state.entity_types = list(filtered.entity_types)
            
            if progress_callback:
                progress_callback(
                    "reading", 100,
                    t('progress.readingComplete', count=filtered.filtered_count),
                    current=filtered.filtered_count,
                    total=filtered.filtered_count
                )
            
            if filtered.filtered_count == 0:
                state.status = SimulationStatus.FAILED
                state.error = "没有找到符合条件的实体,请检查图谱是否正确构建"
                self._save_simulation_state(state)
                raise ValueError(state.error)
            
            # ========== 阶段2: 生成Agent Profile ==========
            total_entities = len(filtered.entities)
            
            if progress_callback:
                progress_callback(
                    "generating_profiles", 0,
                    t('progress.startGenerating'),
                    current=0,
                    total=total_entities
                )
            
            # 传入graph_id以启用Zep检索功能,获取更丰富的上下文
            generator = OasisProfileGenerator(graph_id=state.graph_id)
            
            def profile_progress(current, total, msg):
                if progress_callback:
                    progress_callback(

View on GitHub (pinned to b5b53acc57)

Solutions

  1. Confirm the graph exists and has entities: inspect the Zep graph for the project's graph_id before preparing.
  2. Rebuild the graph (document ingestion + ontology) and verify entity extraction produced nodes.
  3. Align defined_entity_types with the actual labels in the graph (exact names, casing) or relax the filter.
  4. Check the filter implementation for over-restrictive conditions (required fields most entities don't have).

Example fix

# before
manager.prepare_simulation(sim_id, project_id, graph_id='empty-graph', ...)
# after
# verify graph has usable entities first
entities = builder.get_entities_for_simulation(graph_id)
assert entities, 'graph has no entities; rebuild graph before prepare'
manager.prepare_simulation(sim_id, project_id, graph_id=graph_id, ...)
Defensive patterns

Strategy: validation

Validate before calling

entities = builder.get_entities_for_simulation(graph_id)
if not entities:
    raise ValueError('graph has no usable entities; run graph construction first')
manager.prepare_simulation(sim_id, project_id, graph_id=graph_id, ...)

Try / catch

try:
    state = manager.prepare_simulation(sim_id, ...)
except ValueError as e:
    if '没有找到符合条件的实体' in str(e):
        # state is already FAILED; guide user to rebuild graph or relax filters
        return error_response('rebuild the graph or widen entity filters')
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14). Data as JSON: /api/errors/c95cc44eb9cce0af. Report an issue: GitHub.