HumanSignal/label-studio · error · ValueError

Transition '{transition_name}' not found for entity '{entity

Error message

Transition '{transition_name}' not found for entity '{entity_name}'

What it means

execute_transition_with_state_manager looks up the transition class in transition_registry by (entity_name, transition_name). If no class is registered for that pair, it raises ValueError telling you the transition name was not found for the entity.

Source

Thrown at label_studio/fsm/transition_executor.py:55

        transition_data: Data for the transition (validated by Pydantic)
        user: User executing the transition
        state_manager_class: The StateManager class to use for state operations
        **context_kwargs: Additional context data

    Returns:
        The newly created state record

    Raises:
        ValueError: If transition is not found or state model is not registered
        TransitionValidationError: If transition validation fails
    """
    entity_name = entity._meta.model_name.lower()
    transition_data = transition_data or {}

    # Get the transition class from registry
    transition_class = transition_registry.get_transition(entity_name, transition_name)
    if not transition_class:
        raise ValueError(f"Transition '{transition_name}' not found for entity '{entity_name}'")

    # Create transition instance
    transition = transition_class(**transition_data)

    # Extract organization_id from context_kwargs if provided, otherwise use entity's org_id
    organization_id = context_kwargs.pop('organization_id', getattr(entity, 'organization_id', None))

    # Create minimal context with just entity for target_state computation
    minimal_context = TransitionContext(
        entity=entity,
        current_user=user,
        current_state_object=None,
        current_state=None,
        target_state=None,  # Will be computed
        organization_id=organization_id,
    )

    # Get target_state (can now use entity from context)

View on GitHub (pinned to 0b49e9b539)

Solutions

  1. Verify the transition name spelling and case matches the registered key.
  2. Register the transition class: transition_registry.register(entity_name, transition_name, TransitionClass) at app startup.
  3. Inspect the registry (e.g. transition_registry.get_transitions(entity_name)) to see what names exist.
  4. Ensure the module containing registrations is imported during Django app initialization.

Example fix

// before
execute_transition(task, 'start_annotation')  # never registered
// after
transition_registry.register('task', 'start_annotation', StartAnnotationTransition)
execute_transition(task, 'start_annotation')
Defensive patterns

Strategy: validation

Validate before calling

if transition_registry.get_transition(entity._meta.model_name.lower(), transition_name) is None:
    raise LookupError(f"Transition '{transition_name}' not registered for {entity._meta.model_name}")

Type guard

def is_registered_transition(entity, name: str) -> bool:
    return transition_registry.get_transition(entity._meta.model_name.lower(), name) is not None

Try / catch

try:
    execute_transition(entity, transition_name)
except ValueError as e:
    if 'not found for entity' in str(e):
        raise ConfigurationError(f'Check transition registry: {e}') from e
    raise

Prevention

When it happens

Trigger: Calling execute_transition(entity, 'transition_name') where transition_name is misspelled, or the transition class was never registered for that entity's model_name via transition_registry.register.

Common situations: Typos or case mismatches in transition names (registry keys are lowercase model names); transitions registered in a module never imported at startup; adding a new transition but forgetting registration; renaming an entity model without updating registry keys.

Related errors


AI-assisted analysis of HumanSignal/label-studio@0b49e9b539 (2026-08-29). Data as JSON: /api/errors/79d18997f58f0183. Report an issue: GitHub.