scrml.dev v0.8.0
E-SQL-006 · scrml error reference
Reference › Errors

E-SQL-006

.prepare() is removed in Bun.SQL.

Error Compile-time SPEC §44.3 (normative)

Fires at compile time (verified 2026-09-29 against v0.8.0). An earlier version of this page said the bare form built with exit 0 and failed only at runtime. That was true of v0.7.1; the compiler now rejects .prepare() at compile time, and the reproducer below fails the build with E-SQL-006.

What it means

Bun.SQL caches prepared statements internally, so an explicit .prepare() step has no purpose and was removed. Queries run as a bare ?{…} block or through .all() / .get() / .run().

Minimal reproducer

This is the exact source compiled against the compiler and verified to produce E-SQL-006.

<program db="./app.db" title="p">
    <schema>
        users {
            id:    integer primary key
            email: text not null
        }
    </>
    <db src="./app.db" tables="users"/>
    function load() {
        return ?{`SELECT * FROM users`}.prepare()
    }
    <button onclick=load()>load</button>
</>

How to fix

  1. Drop .prepare(). Use the bare ?{…} form, or the terminal method matching the shape you want — .all() for rows, .get() for one, .run() for a write.
  2. Do not add caching of your own. Statement caching is the driver's job and already happening.

Related

Specification

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

← Reference