# Script error 3506: Unknown identifier in a BPVerse `if` body after a two-line parenthesized condition (with Script error 3509 on the same build)

- **Status:** current
- **Engine:** ue6-main `61e2877e`, Linux x86_64, Epic clang 23.1.5 (v27 SDK).
- **Context:** Standalone UE6, BPVerse file in project Content. The example is Coop Zero `Content/fox.verse`, a Verse subclass of a native actor.
- **Prerequisites:** The [C++ actor and BPVerse bridge](/docs/recipes/bpverse-actor-in-headless-editor/), including the project-local reflection-types module on this checkout, and a headless editor Python commandlet that starts the project Verse compile.

## Symptom

The headless editor commandlet exits 255 and the Verse compile fails. `VerseBuild` reports four errors in one file (path shortened):

```text
Content/fox.verse(7,30,7,35): Script error 3506: Unknown identifier `Rules`.
Content/fox.verse(10,34,10,39): Script error 3506: Unknown identifier `Rules`.
Content/fox.verse(10,52,10,57): Script error 3506: Unknown identifier `Rules`.
Content/fox.verse(20,44,20,64): Script error 3509: This function parameter expects a value of type tuple(?coop_chicken,type{_X:int where -2147483648 <= _X, _X <= 2147483647}), but this argument is an incompatible value of type tuple(?coop_chicken,int).
Global Verse compile (incremental, 2 packages compiled in 788.6 ms) finished: FAILED.
```

The three 3506 positions are the uses of `Rules` on lines 7 and 10, the body of an `if` whose parenthesized condition runs over lines 5 and 6. The two uses of `Rules` on line 6, the condition's own second line, were not reported.

## Smallest example / reproduction

The failing file bound `Rules` in a condition whose clause list continues on a second line, then used it in the body.

```verse
if (Entrance := Door?, Entrance.IsOpen()?, Rules := CoopApi.Rules()?,
    Rules.FoxOutcomeHide?, Rules.FoxOrder = e_coop_fox_order.YoungestFirst):
    SpotCount := Min(Rules.HidingSpots, GetSpotCount())
    if (Spot := Mod[Day, SpotCount]):
        for (Index := 1..Rules.FoxVictims, Rules.FoxVictims > 0):
            ...
                        Scared := ScareBird(option{Bird}, Spot)
```

Run the editor against the placement script. The lane ran this through the build wrapper under a bounded timeout; the arguments are as the log's command line records them.

```bash
"$UE/Engine/Binaries/Linux/UnrealEditor-Cmd" "$P/CoopZero.uproject" \
  -run=PythonScript -Script="$P/Scripts/build_slice_map.py" -nullrhi -unattended -nosplash -nosound -stdout \
  '-ddc=(ProjectPak,EnginePak,Local)' "-LocalDataCachePath=$P/DerivedDataCache" \
  '-ini:Engine:[DevOptions.Shaders]:NumUnusedShaderCompilingThreads=24' "-abslog=$P/Saved/step10-place.log"
```

## Solution

1. Write a condition with several clauses as an `if:` / `then:` block, one clause per line. The body then sees the names bound in the condition.

```verse
if:
    Entrance := Door?
    Entrance.IsOpen()?
    Rules := CoopApi.Rules()?
    Rules.FoxOutcomeHide?
    Rules.FoxOrder = e_coop_fox_order.YoungestFirst
then:
    SpotCount := Min(Rules.HidingSpots, GetSpotCount())
```

2. For the 3509 error, follow [Pass a Verse Mod result to a BlueprintCallable integer parameter](/docs/recipes/bpverse-mod-result-native-int/): take the native parameter as `int64` and check it against the array bounds in C++ before narrowing.
3. Fix Verse errors before anything else in the same log. After the failed compile the commandlet's Python also failed with `RuntimeError: Could not load /Game/_Verse.probe for probe.` after `LogUObjectGlobals: Warning: Failed to find object 'Class /Game/_Verse.probe'`. A Verse class from an earlier step was not available in that run. The second message is a consequence of the first failure.

## Why it works

In the `if:` / `then:` form the indented lines up to `then:` are one condition, and the names bound there are in scope in the body. The retry compiled with the body using `Rules` on two further lines.

Why the two-line parenthesized form reported the body uses is not recorded. INFERRED from the reported positions: the binding was visible on the condition's second line but not in the body.

## Verified

- **Evidence level:** runs in editor.
- **How:** `Saved/step10-place.log:2551–2571` has the four error lines and `finished: FAILED.`; lines 2662–2677 have the two probe messages. After both changes, `Saved/step10-place-retry.log:2541` logged `Global Verse compile (incremental, 2 packages compiled in 486.3 ms) finished: SUCCESS.`, and lines 2692–2697 logged three `SLICE_NIGHT_ACTOR` lines and `SLICE_MAP actors=64 map=/Game/Maps/Slice unmanaged=0`. The same Verse file then ran in the Linux package and logged `FOX victim=Hen1 spot=1` (see the Mod result recipe).
- **Date / by:** 2026-11-25, Coop Zero Step 10.

## Limits and assumptions

One file and one condition, on one engine revision. Not recorded: whether every two-line parenthesized condition fails, where the line break must fall, whether the UEFN compiler behaves the same, and whether it is reported to Epic. Both changes went in before the retry, so they were not tested one at a time; the retry log has no `Script error`. One-line parenthesized conditions that bind `Rules` and use it in the body compiled in the same project (`Content/bed.verse`, `Content/egg_rules.verse`).
