scrml.dev v0.7.1
Reference › Errors

E-CHANNEL-OUTSIDE-PROGRAM

A <channel> sits at file top level in a file that also declares <program>. Under v0.3, channels live INSIDE <program> (sibling of <page>).

Error Compile-time SPEC §38.1

What it means

Per §38.1 (v0.3 Wave 1 / S87 Insight 30), the canonical placement for a <channel> is INSIDE the entry file's <program> (as a sibling of <page>), not at file top level next to it. E-CHANNEL-OUTSIDE-PROGRAM fires when both these conditions hold:

  • The file declares a <program> element somewhere.
  • A <channel> sits at file top level — sibling of <program>, not descended from it.

Module-file dispensation

Per §38.12.6 (S87, Insight 30), a file containing NO <program> element MAY declare a <channel> at file top level — the "pure channel file" sharing pattern. The error does NOT fire here. This parallels the existing file-top <engine> permission in module files.

Minimal reproducer

<channel name="cursors">   // E-CHANNEL-OUTSIDE-PROGRAM:
                            // file declares <program> below;
                            // channel must move inside it.
  <positions> = []
</>

<program>
  <page>...</>
</>

How to fix

Move the <channel> inside <program>:

<program>
  <channel name="cursors">
    <positions> = []
  </>
  <page>...</>
</>

OR, if the file's purpose is purely to expose a shared channel (and contains no <program>), split the channel into its own file — the pure-channel-file shape — and import it where needed.

Direction-reversal history

Before v0.3 Wave 1 (2026-05-12), the direction was inverted: the pre-v0.3 error E-CHANNEL-INSIDE-PROGRAM (now retired) fired when a channel was nested inside <program>. The S87 Insight 30 closure (channel-architecture ratification) reversed this: channels are application- scoped shared-state vehicles, and the application is <program>, so the canonical placement is inside it. Adopters migrating from pre-v0.3 source need to move channels INTO <program>.

Related

Specification

Normative text: SPEC §38.1 (channel placement rules) + §38.12.6 (PURE-CHANNEL-FILE dispensation). Catalog row at §34.