scrml.dev v0.8.0
E-CHANNEL-INSIDE-PAGE · scrml error reference
Reference › Errors

E-CHANNEL-INSIDE-PAGE

<channel> is not permitted inside <page>.

Error Compile-time SPEC §38.1 (normative)

Enforced (verified 2026-09-29 against v0.8.0). An earlier version of this page said this code was not emitted. That was true of v0.7.1; the compiler now fires it, and building the two files below fails with E-CHANNEL-INSIDE-PAGE.

What it means

Channels are program-scoped: they own a WebSocket route for the whole application, not for one route within it. Declaring one inside a <page> implies a per-page channel lifetime the runtime does not provide. The canonical placements are inside <program>, or at file top in a pure-channel module file.

Minimal reproducer

Build these two files together (scrml build .); the build fails with E-CHANNEL-INSIDE-PAGE.

app.scrml

<program title="p">
    <outlet/>
</>

pages/index.scrml

<page>
    <channel name="chat">
        <messages> = []
    </>
    <p>${@messages.length}</p>
</>

How to fix

  1. Move the channel into <program>. Declare it once at program scope and read its cells from any page.
  2. Use a pure-channel module file. A file with no <program> element may declare a <channel> at file top and export it.

Related

Specification

Normative text: §38.1, §38.4.1, §38.9, §40.8, §34. Spec lives at compiler/SPEC.md .

← Reference