When edit-time checking is enabled, the Stateflow® Editor detects potential errors and warnings as you work on your chart. By fixing these issues early in the design process, you can avoid compile-time or run-time warnings and errors.
The Stateflow editor highlights objects that violate the edit-time checks in red (for errors) or orange (for warnings). When you point to an object that is highlighted and click the error or warning badge, a tooltip displays details and possible fixes.
By default, edit-time checking and syntax error highlighting are enabled. To disable the edit-time checks, in the Debug tab, clear the Diagnostics > Edit-Time Errors & Warnings check box.
This table lists edit-time checks that have an associated diagnostic configuration parameter on the Diagnostics > Stateflow pane of the Configuration Parameters dialog box.
| Edit-Time Check Issue | Diagnostic Configuration Parameter |
|---|---|
| Dangling Transition | Unreachable execution path (Simulink) |
| Default Transition Path Does Not Terminate in a State | No unconditional default transitions (Simulink) |
| Transition Action Precedes a Condition Action Along This Path | Transition action specified before condition action (Simulink) |
| Transition Loops Outside Natural Parent | Transition outside natural parent (Simulink) |
| Transition Shadowing | Unreachable execution path (Simulink) |
| Unconditional Path Out of State with During Actions or Child States | Transition outside natural parent (Simulink) |
| Unexpected Backtracking | Unexpected backtracking (Simulink) |
| Unreachable Junction | Unreachable execution path (Simulink) |
You can control the level of diagnostic action for these edit-time checks by
setting the value of their configuration parameter to error,
warning, or none. When you change
the setting for a configuration parameter, the diagnostic level for the corresponding
edit-time checks also changes. For example, if you set the Unreachable execution
path configuration parameter to none, then the Stateflow Editor does not highlight dangling transitions, transition shadowing, or
unreachable states.
Atomic Subchart Contains State ActionsIssue: State actions are not supported on atomic subcharts.
Diagnostic level: Error.
Solution: Delete the state actions or move them to a substate of the atomic subchart.

Default Transition Is MissingIssue: In a chart or state with exclusive (OR) decomposition and at least two substates or junctions, a default transition is required to indicate where the execution begins.
Diagnostic level: Error.
Solution: Specify an initial state by adding a default transition. For more information, see Default Transitions.

Graphical Function Contains a StateIssue: Because graphical functions execute completely in a single time step, they must not contain any states.
Diagnostic level: Error.
Solution: Replace the states with junctions. For more information, see Reuse Logic Patterns by Defining Graphical Functions.

Invalid IntersectionIssue: States and junctions must not overlap in the Stateflow Editor.
Diagnostic level: Error.
Solution: Avoid intersections by separating the states and junctions.

Monitoring Leaf or Child State Activity of Parallel StatesIssue: Charts and states with parallel (AND) decomposition do not support monitoring of leaf or child state activity because parallel substates are active simultaneously.
Diagnostic level: Warning.
Solution: Open the Property Inspector or the
Model Explorer. Clear the Create output for monitoring check box
or select Self activity from the drop-down list. For more
information, see Monitor State Activity Through Active State Data.

State Contains a Syntax ErrorIssue: A state action does not follow the
Stateflow syntax rules. The Stateflow Editor underlines syntax errors with a red, wavy line. See also Transition Contains a Syntax Error.
Diagnostic level: Error.
Solution: Correct the syntax error in the state action. For more information, see State Labels.

Note
In the parent chart, subcharts with syntax errors are highlighted in red and an error badge indicates the syntax issue. In the subchart editor, the syntax error is underlined in red, but there is no badge to indicate the issue.
Unreachable StateIssue: A state is unreachable when no valid execution path leads to it.
Diagnostic level: Depends on the configuration parameter Unreachable execution path (Simulink).
Solution: Connect the unreachable state with a transition from a reachable state or junction.

Dangling TransitionIssue: Every transition must have a valid destination state or junction.
Diagnostic level: Depends on the configuration parameter Unreachable execution path (Simulink).
Solution: Connect the transition to a state or junction. For more information, see Transitions.

Default Transition Path Does Not Terminate in a StateIssue: In charts or states with exclusive (OR) decomposition and at least one substate:
Every path along the default transition must lead to a substate.
There must be one default transition path that is not guarded by a condition or triggered by an event.
Diagnostic level: Depends on the configuration parameter No unconditional default transitions (Simulink).
Solution: Terminate every path along the default transition in a substate. Ensure that one default transition path is not guarded by a condition or triggered by an event.

Invalid Default Transition PathIssue: A default transition path must not exit the parent state.
Diagnostic level: Error.
Solution: Modify the default transition path so it stays within the parent state.

Transition Contains a Syntax ErrorIssue: In a transition, a condition or action
does not follow the Stateflow syntax rules. The Stateflow Editor underlines syntax errors with a red, wavy line. See also State Contains a Syntax Error.
Diagnostic level: Error.
Solution: Correct the syntax error in the transition condition or action. For more information, see Transition Labels.

Transition Action Precedes a Condition Action Along This PathIssue: When a transition with a transition action is followed by a transition with a condition action, the actions are not executed in the order of the transitions. Stateflow charts execute condition actions when the associated condition is evaluated as true. In contrast, charts execute transition actions only when the transition path is fully executed. As a consequence, a chart takes a transition path, the condition actions occur before the transition actions.
Diagnostic level: Depends on the configuration parameter Transition action specified before condition action (Simulink).
Solution: Place the transition action after the last condition action on the path.

Transition Begins or Ends in a Parallel StateIssue: In charts and states with parallel (AND) decomposition, all sibling substates are active or inactive at the same time.
Diagnostic level: Warning.
Solution: Remove the transitions or change the decomposition of the parent state to exclusive (OR).

Transition Connects to a BoxIssue: Transitions can only connect to states and junctions.
Diagnostic level: Error.
Solution: Move or delete the transitions attached to the box.

Transition Crosses Parallel StatesIssue: Standalone Stateflow charts do not support transitions that cross the boundary of a parallel state.
Diagnostic level: Error.
Solution: Delete the transition crossing into or out of the parallel states.

Transition Enters or Exits Graphical FunctionIssue: Transitions must not enter or exit a graphical function. Flow charts in graphical functions must be completely contained inside the function.
Diagnostic level: Error.
Solution: Delete the transition entering or exiting the graphical function.

Transition Loops Outside Natural ParentIssue: If a transition goes outside the parent
state between the source and destination, the chart executes the
exit and entry actions of the parent state
before the destination state becomes active.
Diagnostic level: Depends on the configuration parameter Transition outside natural parent (Simulink).
Solution: Move the transition so that it is contained within the parent state.

Transition ShadowingIssue: When an unconditional transition executes before other outgoing transitions from the same source, it prevents the other transitions from executing.
Diagnostic level: Depends on the configuration parameter Unreachable execution path (Simulink).
Solution: Create no more than one unconditional transition from each state or junction. Explicitly specify that the unconditional transition executes after any transitions with conditions. For more information, see Transition Evaluation Order.

Unconditional Path Out of State with During Actions or Child StatesIssue: Unconditional transitions leading out of a
state inhibit the execution of the during actions in the state and
the default transitions to child states.
Diagnostic level: Depends on the configuration parameter Transition outside natural parent (Simulink).
Solution: Add a condition to the transition or remove during actions and child states from the state.

Cycle Contains Transitions with Transition ActionsIssue: Cycles should not contain transitions with transition actions.
Diagnostic level: Error.
Solution: Remove the transition action or remove the cycle by deleting a transition.

Invalid History JunctionIssue: A history junction is invalid when:
The history junction is contained in the chart level of the hierarchy.
The history junction is contained in a state with parallel (AND) decomposition.
The history junction is contained inside a graphical function.
There are multiple history junctions contained in the same state.
The history junction is the source of a transition.
Diagnostic level: Error.
Solution: Remove the history junction from the chart level of the hierarchy, a state with parallel (AND) decomposition, or a graphical function. Remove all but one history junction from the state. Move the transition source to a connective junction or a state. For more information, see Record State Activity by Using History Junctions.

Junction Has No Unconditional Escape from CycleIssue: A junction must have an unconditional escape path from a cycle to a state or terminating junction.
Diagnostic level: Error.
Solution: Create an unconditional path from the junction to a state or terminating junction.

Unexpected BacktrackingIssue: Unexpected backtracking of control flow can occur when multiple transition paths from the same source lead to a junction and the junction does not have an unconditional path to a state or terminating junction.
Diagnostic level: Depends on the configuration parameter Unexpected backtracking (Simulink).
Solution: Create an unconditional path from the junction to a state or terminating junction. For more information, see Backtrack in Flow Charts.
For example, the highlighted junction in this chart does not have an unconditional
transition path to state A. If ConditionA and
ConditionB are true and ConditionC is false,
the chart backtracks to the first junction in the path multiple times. As a result,
the chart executes the three condition actions.
![]()
To avoid backtracking, combine the conditions and create an unconditional path from the second junction to the destination state. After the change, the chart executes only one condition action.
![]()
Unreachable JunctionIssue: A junction is unreachable when no valid execution path leads to it.
Diagnostic level: Depends on the configuration parameter Unreachable execution path (Simulink).
Solution: Connect the unreachable junction with a transition from a reachable state or junction.

Function is UnusedIssue: A function is unused when a chart when there are no statements that call the function.
Diagnostic level: Warning.
Solution: Call the function from a state or transition action or from another function.

Invalid Use of Keywords as Function ArgumentsIssue: A function definition uses a reserved keyword as an argument.
Diagnostic level: Error.
Solution: Rename the argument to the function. For a list of reserved keywords, see Guidelines for Naming Stateflow Objects.
