symfony/symfony · error · InvalidConfigurationException

The "from" arcs must be a list of strings or arrays in workf

Error message

The "from" arcs must be a list of strings or arrays in workflow configuration.

What it means

Thrown by the workflow arc normalizer (used for both `from` and `to`) when an element of the list is neither a string, a BackedEnum, nor an array. Arcs must describe a place (string/enum) or a place+weight structure (array), so any other type is rejected.

Source

Thrown at src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php:676

                                                    ->beforeNormalization()
                                                        ->ifArray()
                                                        ->then($workflowNormalizeArcs = static function ($arcs) {
                                                            // Fix XML parsing, when only one arc is defined
                                                            if (\array_key_exists('value', $arcs) && \array_key_exists('weight', $arcs)) {
                                                                $arcs = [[
                                                                    'place' => $arcs['value'],
                                                                    'weight' => $arcs['weight'],
                                                                ]];
                                                            } elseif (\array_key_exists('place', $arcs)) {
                                                                $arcs = [$arcs];
                                                            }

                                                            $normalizedArcs = [];
                                                            foreach ($arcs as $arc) {
                                                                if (\is_string($arc) || $arc instanceof \BackedEnum) {
                                                                    $arc = ['place' => $arc];
                                                                } elseif (!\is_array($arc)) {
                                                                    throw new InvalidConfigurationException('The "from" arcs must be a list of strings or arrays in workflow configuration.');
                                                                } elseif (\array_key_exists('value', $arc) && \array_key_exists('weight', $arc)) {
                                                                    // Fix XML parsing
                                                                    $arc = [
                                                                        'place' => $arc['value'],
                                                                        'weight' => $arc['weight'],
                                                                    ];
                                                                }

                                                                if (($arc['place'] ?? null) instanceof \BackedEnum) {
                                                                    $arc['place'] = $arc['place']->value;
                                                                }

                                                                $normalizedArcs[] = $arc;
                                                            }

                                                            return $normalizedArcs;
                                                        })
                                                    ->end()

View on GitHub (pinned to 698e28026c)

Solutions

  1. Ensure every `from`/`to` element is a place name string, a BackedEnum, or an array with a `place` key.
  2. Quote place names in YAML if they could parse as numbers/booleans.
  3. For weighted arcs use `[{ place: <name>, weight: <int> }]`.

Example fix

// before - integer place name
framework:
    workflows:
        order:
            transitions:
                pay: { from: [1], to: [2] }

// after - string place names
framework:
    workflows:
        order:
            transitions:
                pay: { from: ['1', '2'], to: ['paid'] }

// or weighted arc
framework:
    workflows:
        order:
            transitions:
                pay: { from: [{ place: pending, weight: 1 }], to: [paid] }
Defensive patterns

Strategy: type-guard

Validate before calling

// Validate each arc is a string, BackedEnum, or a place-array
foreach ($arcs as $arc) {
    if (!is_string($arc) && !$arc instanceof \BackedEnum && !is_array($arc)) {
        throw new \InvalidArgumentException('Each "from"/"to" arc must be a string, BackedEnum, or array.');
    }
}

Type guard

function isValidArc(mixed $arc): bool
{
    return is_string($arc) || $arc instanceof \BackedEnum || (is_array($arc) && isset($arc['place']));
}

Prevention

When it happens

Trigger: Setting a transition's `from: [123]` (integer), `from: [null]`, or `from: [{ nested: { deep: x } }]` (non-place array) where an element is an unsupported type.

Common situations: YAML quoting issue turning a place name into a non-string; accidentally nesting arrays; config generated programmatically producing ints/nulls; malformed XML.

Related errors


AI-assisted analysis of symfony/symfony@698e28026c (2026-08-06). Data as JSON: /api/errors/eeeaa4fa2ed2cc03. Report an issue: GitHub.