beck / Error indexSource

Error index

127 codes, every one the compiler can emit. beck explain error B0341 prints one at the terminal.

Reading the source B0100–B0122

CodeMeaning
B0100errorunrecognised character — The character is not a Beck token. Lexing continues past it so that one stray character does not hide every other problem in the file.
B0101errorinconsistent indentation — This line's indentation matches no enclosing block. Indentation is significant, and §2.6 fixes it as spaces only, four per level — a tab is a lint rather than a width question. Blank and comment-only lines have no indentation at all, so a comment at column zero does not close a block.
B0102erroran invisible control character in the source — A bidirectional formatting character (UTS #39 §4.1; CVE-2021-42574) or a zero-width no-break space away from the start of the file. These change how the text after them is *displayed* without changing what it means, so a reviewer and the compiler can read the same file differently. Write `\u{...}` if a string genuinely needs one.
B0103erroran identifier outside the ASCII profile — Beck's identifiers are `[A-Za-z_][A-Za-z0-9_]*`, which is UTS #39's ASCII-Only restriction level. Confusable and mixed-script identifiers are therefore not something the compiler checks for; they are something a program cannot contain.
B0110errorexpected a single form — `beck ast` and the macro-debugging paths read exactly one S-expression. A file with a second form at top level is a module, and is read with the module reader instead.
B0111errorunbalanced closing delimiter — A `)`, `]` or `}` with no matching opening delimiter.
B0112errorunclosed list — A list opened here and the file ended before it closed. The span points at the opening delimiter, which is the one worth looking at.
B0113errormismatched closing delimiter — The closing delimiter is not the one this form opened with — `(a]`. Both spans are reported: where it opened, and where it was closed wrongly.
B0114errorempty application — `()` has no meaning: an application's head is its first element, and there is none. Write `unit` for the unit value.
B0115errorunclosed string — A string literal opened and the line or file ended before the closing quote. Beck string literals do not span lines.
B0116errorunreadable character — The S-expression reader cannot begin an atom with this character.
B0120errorunexpected token — The Python-surface parser expected something else here; the message names what. One error per item: the parser recovers to the next top-level item, so a bad line does not make the rest of the file unparseable.
B0121errornesting is too deep to read — The source nests deeper than the front end follows — `beck_diag::depth::MAX_NESTING` levels of brackets, indentation or S-expression lists. The bound is a fixed count rather than a reading of the stack, so the same file is accepted or refused identically in every build; without it, deep enough input aborted the process with no span at all.
B0122erroran expression chains more operators than the reader will follow — A left-associative chain — `1 + 1 + 1 + …` — is flat in source and builds a left-leaning tree of the same depth, one level per operator. The Pratt loop that reads it does not recurse, so none of the parser's recursion counters sees the depth, and a long enough chain reached the end of the host stack in whatever walked the tree afterwards. The bound is `beck_diag::depth::MAX_BLOCK` — the same ceiling a block of sequential bindings takes, because it is the same axis: a flat run of things that costs one tree level each.

Macro expansion B0200–B0213

CodeMeaning
B0200errormacro is defined twice — Two macros in one module share a name, and a later definition would silently win.
B0201errormacro expansion did not terminate — Expansion ran past the depth limit — usually a macro that expands to a call to itself.
B0202errormacro expects an argument — A parameter of the macro received nothing at this call site. The macro's definition is reported as a secondary span.
B0203errortoo many arguments for macro — More arguments than the macro declares parameters.
B0204errormacro returns nothing — A macro body ends without `return quote: …`, so there is no template to instantiate.
B0205errorunsupported statement in a macro body — Phase 1 macro bodies are `let` bindings and a final `return quote: …`. Arbitrary compile-time computation arrives with the macro interpreter, which is not built.
B0206errorunquoting an unbound name — `$x` inside a template names something that is not a parameter of this macro.
B0210error`ui` needs an indented block — Write `ui:` followed by an indented element.
B0211error`ui` block is empty — A view must produce exactly one root element.
B0212error`ui` block has more than one root — An `Html` value is a single tree. Wrap the elements in one — a `div:` or `main:` block.
B0213errorthe form nests too deep to expand — The expander walks a form's arguments as deeply as they nest, and stops at the count the reader stops at. This is not `B0201`: nothing here says a macro failed to terminate — the two were one counter until they were separated, and a deep expression with no macros in it reported the wrong one.

Names, types and effects B0300–B0399

CodeMeaning
B0300errornot a tier — `@on(…)` takes `client`, `server`, `data` or `any`.
B0301warningunsupported decorator — The compiler understands `@on(client|server|data|any)` and `@signal`. A warning rather than an error, so an unknown decorator does not stop a build — but it does nothing.
B0302errortype is declared twice — Two declarations in this module share a type name.
B0303errora top-level parameter needs a type annotation — Inference is intra-module and boundaries are declared (§3.6): a top-level definition's parameters are part of its published signature, so they are written rather than guessed.
B0304errorneeds a return type — Same reason as B0303: a top-level definition's result type is part of its contract.
B0305errorneither an effect nor a row — A `uses` clause names effect atoms and row aliases, and this is neither. `beck doc reference` lists the atom set; a `row Name = …` declaration in the module is what makes a name for a bundle of them.
B0306erroris not a rendering mode — `@render` takes `server` (Mode A: the server renders and the wire carries DOM patches) or `client` (Mode B: the browser renders and the wire carries the state).
B0307errorunsupported top-level item — This form is not something a module may contain at top level.
B0308errorexpected a type — A type position holds something that is not a type expression.
B0310errorcannot find type — No declaration, import or builtin of that name is in scope.
B0311errorwrong number of type arguments — A mention of a type carries one argument per declared parameter — `union Tree[T]` is written `Tree[Int]`, never bare `Tree`.
B0312errora type alias defined in terms of itself, or a name the language reserves — An alias is transparent, so a self-referential one describes no type — a `union` may be recursive, an alias may not. The same code covers a definition named after a reserved form such as `record`, which would compile and never be reachable.
B0313errora type parameter takes no type arguments — A type parameter of the definition or declaration being read names an unknown type, so it has no structure to apply arguments to: `T[Int]` says nothing, whatever `T` turns out to be at the call site.
B0314errora type parameter shadows an existing type — A type parameter is a name the definition or declaration invents, and one that shadowed an existing type would make its fields or its signature read as though they mentioned that type.
B0315errora type parameter is repeated — The same name appears twice in one type-parameter list, where the second would silently shadow the first.
B0316errora declaration cannot bound its type parameter — A bound says what a body may call, and a `model`, a `union`, a `newtype` and a `type` have no body. The definitions that take the type apart are where the bound belongs.
B0317errora declaration shadows a builtin type — `Int`, `Str`, `Bool`, `Float`, `Unit`, `Html`, `Attr`, `list`, `Map`, `Stream`, `Signal`, `Envelope`, `secret` and `internal` are the language's own type names, and a `model`, `union`, `newtype` or `type` may not take one. B0314 has refused the same shadowing for a type *parameter* since docs/36; a declaration was the production it did not cover, so the name meant the builtin in one signature and the declaration in the next (docs/87 §87.4).
B0320errortype mismatch — Unification failed; the message names what was being unified — an argument, a field, a result, or the two branches of an `if`. The branches of an `if` are reported as two alternatives rather than as actual-and-expected: typing one as the other's expectation is what refused SICP exercise 1.43 (docs/27 §27.3).
B0330warningstatements after `return` are unreachable — A `return` ends its block; anything after it never runs.
B0331errorloops are not available in Phase 1 — Everything is an expression and `var` is not yet mutable, so a loop has nothing to accumulate into. Use `map_list`, `filter_list` or `fold`.
B0332errora `quote` survived macro expansion — A template reached the checker, which means it was never instantiated. Quoted forms are data for a macro, not code.
B0333errora keyword argument outside a call — `name=value` is call syntax and has no meaning as an expression on its own.
B0334errorunsupported expression — This form has no meaning in expression position.
B0335errorhas no body — A bodyless `def` is a declaration, which is what a `.becki` interface file is made of; an ordinary module has to define what it declares.
B0340errorcannot find name in this scope — No local, parameter, top-level definition, import or prelude name matches — after hygiene, which means a name a macro introduced is not visible to code the macro did not write.
B0341errormatch is not exhaustive — The missing variants are listed. This is deliberate and load-bearing: adding a variant must break every fold that consumes it, which is what makes a missed migration a compile error rather than a 3 a.m. page.
B0342errorunsupported pattern — A `case` arm's pattern is a variant applied to field bindings, or `_`. This form is neither.
B0343errornot a constructor — The head of a pattern must be a variant of the union being matched.
B0344errorcannot tell which field this binds or sets — A pattern or record update names a field the compiler cannot resolve to the type in hand.
B0345errorthe tail of a list pattern is a name, not a pattern — The tail of a list pattern binds the rest of the list, so it takes a name or `_`. `[a, *[b, c]]` is `[a, b, c]` written twice over.
B0346errorcannot tell which model this record builds — A record literal's type comes from what is expected of it, and nothing here says which model it is.
B0347errorexpected a field or method name — The right-hand side of a `.` must be a name.
B0348error`with` takes named fields — Functional record update is written `t.with(done=…)`.
B0349errorno such field on this type — The field named in a `with` is not declared on the model being updated.
B0350errorno field or function for this type — A `.` reached neither a field of the receiver nor a function that could take it.
B0351errorwrong number of arguments — A call passes a different number of arguments than the function or constructor takes.
B0352errornot callable — The callee's type is not a function type.
B0353errorno such variant — The union being constructed or matched has no variant of that name. The type is named in the message.
B0354errorcannot construct this type — The name is a type, but not one with a constructor — an alias or a builtin.
B0355errorthis case can never match — Every value the arm matches is already matched by an arm above it, so it cannot run. A warning rather than an error: `case _` written after every variant of a union is a habit rather than a mistake.
B0356errorthe alternatives of an or-pattern bind different names — Every alternative of `a | b` has to bind the same names at the same types, because the body reads them without knowing which one matched.
B0357error`|` and `@` are only meaningful in a `case` pattern — Beck has no bitwise operators. `|` separates the alternatives of an or-pattern, `@` names the value a pattern takes apart, and neither means anything anywhere else.
B0358errorthe left of `@` is a name — `whole @ Circle(r)` binds `whole` to the value the pattern matched. What stands to the left of `@` is the name being bound.
B0359erroran identity declaration this compiler cannot derive a deployment from — `identity = external(issuer="https://login.acme.com")` and `identity = managed()` are the two forms, and a program declares at most one. An external issuer is an `https` URL — the key set's only integrity protection is the transport it arrives over — and its host has to be one an egress rule could name, because §6.5 derives the cluster's rule from it. `managed()` takes no arguments: it provisions a provider into the object graph, and the issuer is a Service the deployment names rather than the program.
B0360errorcannot be called inside a fold — A fold must be replay-pure, and this would make replay non-deterministic. Time is data on the envelope (`env.at`) and entity ids are minted at the edge: mint the id in the client's command and read it from the event.
B0370errorperforms more than its signature declares — The undeclared atoms are listed. A `uses` clause is the published bound, and widening it is a breaking API change — so the compiler will not widen it for you.
B0380errora trait cannot be declared here — The name already belongs to a type, the trait is declared twice, or the file is a `.becki` — a trait does not cross a module boundary, so an interface may not hold one.
B0381errora trait declaration is wrong — A trait holds `def` signatures with no bodies, each mentioning `Self` in a parameter so that a call has something to dispatch on. A method name belongs to one trait only.
B0382erroran impl does not match its trait — An impl writes bodies and parameter *names*; the types, the return type and the effect row are the trait's. Every method must be implemented, exactly once, and no others.
B0383errorcannot find the trait or the type this impl names — Both halves of `impl Trait for Type` have to resolve before the impl can be registered.
B0384errorconflicting implementations — Coherence: one impl per trait per type constructor, and no blanket impl over a type parameter — so what a call means never depends on which impls happen to be in scope.
B0385errororphan impl — An impl belongs with the trait or with the type. Implementing somebody else's trait for somebody else's type is what lets two modules supply one and disagree.
B0386errorno implementation can be chosen here — An implementation comes from a concrete type or from a bound on a type parameter — write `[T: Trait]` to say the parameter has one. A trait method and a bounded definition are both called rather than passed: the implementation is supplied at the call site, so a reference that is never called has nowhere to receive it.
B0387errorthe type does not implement the trait — There is no `impl Trait for Type` in scope for the receiver's type.
B0389errora block has more statements than the checker will follow — A block is a chain of `let`s however flat it looks in source, so the checker recurses once per statement and a long enough body reaches the end of the host stack. The bound is `beck_diag::depth::MAX_BLOCK` — much larger than the nesting ceiling, because 256 levels of nesting is pathological and 256 sequential bindings is merely a long function. It is a fixed count rather than a reading of the stack, so the same file is accepted or refused identically in a debug and a release build; without it, a long enough body aborted the process with no span at all.
B0390errorthe expression nests too deep to check — The checker walks an expression and a type as deeply as they nest, and stops at `beck_diag::depth::MAX_NESTING` levels — the same count the reader stops at, because the checker can be handed a tree a macro produced rather than one anybody typed. Everything downstream walks the `Core` this pass built, so it is bounded by the same number.
B0391errora raised value must have a declared type — `raise` performs `raises(T)`, and the atom names `T` so that a handler can say what it catches. A builtin will not do: `raises(Int)` would make every integer failure in a program the same failure, and a handler could not tell them apart.
B0392errornothing here can fail, and nothing says what this would catch — A `try:` reifies one failure into a `Result`, and it takes the error type from the enclosing signature's `Result[T, E]` where there is one and from the block's own row where there is not. Neither said anything here. Either the call you meant to make is not there, or the `try:` is left over from a signature that has stopped failing — which is the good case, and the diagnostic is how you find out.
B0393errorthe block can fail in more than one way, and nothing says which to catch — A `Result[T, E]` has one error type, and a `try:` catches one — the rest keep travelling, which is what makes a handler composable. Here nothing named which: give the enclosing definition a `Result[T, E]` return type, and the handler catches that `E`.
B0394errorthe row is declared twice — Two `row Name = …` declarations with the same name. A row alias is a name for a bundle of effect atoms, and a second one would make every `uses` clause mentioning it ambiguous.
B0395errorthe host of an outbound call has to be written at the call site — `http_fetch` performs `net.out(host)`, and §6.5 derives the cluster's egress policy from that atom and nothing else. A host computed at run time is an outbound call the deployment cannot be told about, so the argument is read where it is written. Compute the path, the port, the headers and the body; or take a closure, so the caller names its own host and the row carries the atom out.
B0396errorthat is not a host an outbound call can name — The host becomes a NetworkPolicy peer and a `uses net.out(…)` clause, both of which are written as bare DNS labels — so a scheme, a port or a path in it is a name neither could carry. `origin` is refused for a different reason: it is the one outbound atom a client tier discharges, and a client reaches its own server over the command channel.
B0397errora parallel scope has fewer than two children — A `parallel:` scope runs its bindings as children. With one there is nothing to run it alongside, and with none there is nothing to run — either way the form is claiming a concurrency it does not have, and an ordinary block says the same thing without the claim. The tail is everything after the last binding, so a scope written with its work in the tail has no children either.
B0398errora child of a parallel scope names another child — The children of a `parallel:` scope run together, so none of them can see another's result — a child that could would have to run second, and then it is not a child but a next line. Move the reader into the scope's tail, which runs after the join with every child's result in scope, or out into a second scope below this one.
B0399errora child of a parallel scope performs an effect another child could observe — The claim a `parallel:` scope makes is that its answer does not depend on the order its children ran in, and an effect on state the program holds — the log, the document, the merge point, a file, an external store — breaks it: two children appending to the log in the other order is a different log. `net.out(host)` is not on that list and is the case the form exists for. Do the shared-state part in the tail, which runs once, after the join.

Placement B0400–B0405

CodeMeaning
B0400errorperforms effects no single tier can discharge — Each tier discharges a fixed set (§3.3). A row no tier covers has to be split across definitions that can each be placed.
B0401errorplaced on a tier that cannot discharge an effect it performs — The written `@on(…)` and the inferred row disagree. The diagnostic names the atom, the tier, and the tiers that could discharge it. `ingress` is the merge point and only the server holds it; `durable` is the data tier's; `dom` is the browser's.
B0402errora fold function must be replay-pure — The function reached by a `fold` performs effects that replay would not reproduce. Both the fold and the definition are reported.
B0403errora program has exactly one merge point — A second `merge_clients()`. The merge point is where time and nondeterminism enter; two of them would mean two total orders, and replay would no longer be a function of the log.
B0404errorcannot be unplaced — `@on(any)` means every tier, and an atom in the row is not discharged on every tier. The fix-it names the tiers that can.
B0405erroronly a component can say where it renders — `@render` was written on something that is not a `Signal[Html]`. A definition is unplaced code compiled to every tier that needs it (§3.3); rendering is decided per component.

Placement and security B0410–B0412

CodeMeaning
B0410errorruns on the client, so its value must be Sendable — This value crosses to the browser, and §3.5's claim is that the compiler proves a secret cannot. The offending field and the path that reaches it are both named — `beck explain flow <Type>` prints the same walk.
B0411errordurable, so its state must be storable — The log is the only description of this program's history; a value it cannot read back is a state replay would not reproduce.
B0412errorrequires a capability nothing can discharge — A `Session` reaches exactly one place in a Beck program: the validator `decide` is given, which is the only function handed a `Proposal`. Authority is one chokepoint (§3.5), so a capability required outside it has no holder.

The signal graph and the slicer B0500–B0514

CodeMeaning
B0500errorthis program has no merge point — A Beck application is a fold over an event stream, and the stream starts at `merge_clients()`. Not an error for a library: this code, with B0501 and B0505, is what says a module is a domain module rather than an application.
B0501errorthis program has no durable state — `durable(fold(f, init, s))` is what makes the log a database.
B0502error`durable` must wrap a `fold` — Only a fold has an accumulator to persist.
B0504errorevents must come from `decide` — The fold has no chokepoint upstream of it. `decide` is the sole consumer of ingress and the one place a command becomes an event — §3.5's "authority is one chokepoint".
B0505errorno signal is placed on the client — `page` is the tier crossing: a `Signal[Html]` the browser subscribes to.
B0506errornot a signal — A signal's inputs are other signals. A function is applied *through* a construct — `signal_map(s, f)` — rather than named as an input.
B0507errornot a signal construct — §3.7's signal vocabulary is `merge_clients`, `filter_map`, `fold`, `durable`, `signal_map`, `map2`, `per_session` and `decide`.
B0508errorunsupported signal expression — A signal is a node in the dataflow, not a computation. The computation goes in a `def` and the signal names it: `summary: Signal[Summary] = signal_map(counts, summarise)`.
B0509errora signal defined in terms of itself — The cycle is printed. A cycle through a `fold` is sound — an accumulator is a value, so the recursion has a bottom, which is why `events → todos → events` is legal. One with no fold in it has no first value to compute from.
B0510errortwo signals are the page, and there is no router yet — The slicer will slice both; the runtime serves one document per connection, and choosing between them is routing — a Phase 3 client bullet that is not built.
B0511errora program has one authority chokepoint — A second `decide`. §3.5 rests on validation being one place: two of them are two answers to "may this actor do this", and the log would record whichever ran.
B0512errorthe chokepoint does not read a durable fold — `decide` threads the accumulator through validation, so what it reads has to be one — that is what makes first-writer-wins and ownership decidable (§3.7).
B0513errora fold that is not durable — Its accumulator has nowhere to live across a restart. The log is what survives, and `durable` is what says an accumulator is folded from it.
B0514errorrenders differently for each session, so it cannot render on the client — The page reads the session as well as the state, so it filters, scopes or hides by identity. `@render(client)` sends the browser the state rather than the page, which would hand every actor what the filter was removing (docs/94 §94.2).

Modules and interfaces B0600–B0605

CodeMeaning
B0600errorhas a body, so it is not a signature — A `.becki` publishes what a module offers, not how it does it. Regenerate it with `beck iface`.
B0601errordefined in more than one module — Phase 2 links modules into one namespace and has no qualified reference to tell two definitions apart, so a clash is an error rather than a shadowing rule.
B0602errora module imports itself, directly or through a cycle — A module's interface is derived from its body, so a cycle would mean each module needed the other's contract before either had one. The cycle is printed.
B0603errorcannot find module — The loader looked for `<name>.becki` and `<name>.beck` beside the root module, and for a standard-library module of that name, and found neither.
B0604errorhas an interface but no implementation — An interface is enough to compile against and never enough to run.
B0605errordoes not match its published interface — The checked-in `.becki` and the module compile to different digests. Regenerate it with `beck iface`, and review the diff — the difference is an API change.

Tests written in Beck B0700–B0707

CodeMeaning
B0700errora test block performs effects — A test block's own row must be empty: an expectation is a pure question about a state, a log and a page. Effects belong to the *subject*, and §21.3 stubs those.
B0701errora property parameter needs a type — The generator is type-directed, so it works from the parameter's declared type. A `property` with no types has nothing to generate.
B0702errornot a tier, or not an effect atom — `expect place(name) == tier` takes a tier, and a `stub` names an effect atom.
B0703errornot something a stub can stand in for — Time, ids and persistence are not stubbed in Beck and there is nothing to write: the clock is data on the envelope, ids are minted at the edge, and the durable fold is real and in memory.
B0704errornothing in this program performs this atom — The stub would never be reached. The complete list of what a program touches is its effect rows, and this atom is not among them.
B0705erroronly `given`, `when`, `stub` and `expect` may appear in a test — §21.2: a test names a log, an input and an expectation — there is no fixture to build and no `setUp` to write.
B0706errora clause needs something this program does not have — The state a test arranges is a fold over the program's own event stream, so a program with no `merge_clients` → `decide` → `durable(fold(…))` has nothing for `given` and `when` to mean.
B0707erroran atom is performed by more than one definition, so a stub cannot answer from the call — The performers are named. A stub is a value for an effect atom; where two definitions perform the same atom with different result types, one value cannot serve both.