scrml.dev v0.7.1
Reference › Errors

E-SQL-008

A ?{ SQL block has no matching }.

Error Compile-time SPEC §8.6 (normative)

Verified behaviour, 2026-07-26 against v0.7.1. In practice you will usually see a structural error instead. An unterminated ?{ swallows the rest of the file, including the closing tags, so the block splitter reports E-CTX-003: Unclosed 'program' first and the build stops before the SQL-specific diagnostic is reached. The probe below produces E-CTX-003, not E-SQL-008. If you get an unexplained unclosed-element error, suspect an unterminated SQL block.

What it means

The SQL template is unterminated. The compiler names the three usual causes: a missing closing brace, an unterminated backtick template literal inside the SQL body, or an unmatched ${ interpolation.

Minimal reproducer

This is the exact source compiled against the linked compiler to establish the behaviour described above. Read the callout at the top of this page before using it — it does not produce E-SQL-008.

<program db="./app.db" title="p">
    <db src="./app.db" tables="users"/>
    function load() {
        return ?{ SELECT * FROM users WHERE id = ${uid }.all()
    }
    <button onclick=load()>load</button>
</>

How to fix

  1. Close the SQL block. Check for a stray ${ inside the query — an interpolation opened and not closed swallows the block's own terminator.
  2. Check backticks inside the body. An unclosed backtick template makes everything after it part of the string.

Related

Specification

Normative text: §8.6, §44.7, §44.8, §34. Spec lives at compiler/SPEC.md .

← Reference