---
title: "Actions"
description: "A new tab’s child fails to start. A command-line run ends while the data module still works on a thread."
modificationDate: "2026-12-01"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/reference/pitfalls/actions: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

- **A new tab’s child fails to start.** A desktop app can run 16 streaming children and hold 16 network streams at once. Share a child across documents when more than 16 documents need one. Use one poll carrying the changes for all documents (design tool, #1759).
- **A command-line run ends while the data module still works on a thread.** A terminal entry run once from a shell (`--print`, or stdout a pipe) exits
  when nothing holds it: no request in flight, no one-shot timer armed and no
  node `aria-busy` (LLP 1101.003 D2). A thread the module started after
  answering a send is none of these, so the run settles and prints before
  the work is done. Keep a node `aria-busy` from the send until the thread
  has finished, as the harness's live column does with `session.busy`
  (`apps/harness/terminal.contract`). (The harness's `--print`, 2026-11-12.)

- **A page's own state that `back` resets is reset when a sheet over the page closes.**
  Symptom: a page in edit mode stops editing when a sheet it opened (a picker
  route with `navigationPresentation="modal"`) closes with its Done. Cause: the
  editing state was the root's, reset in the root's `back` action so that leaving
  the page ended it; `back` also closes the route above the page, so the sheet's
  Done ran it too. What to do: make the page a component used under the stack's
  `for e in stack(nav) key=e.id` and give it the state. A child under `for` owns
  state keyed to its row, so the state is made when the route is pushed, stays
  while routes and sheets sit above it, and goes when the route is popped, as
  SwiftUI's `@State` on a pushed view does, and no navigation action resets it.
  (The Landscapes template's collection editor, 2026-11-07.) **Candidate
  diagnostic:** the root's `navigationBack` or `navigate` handler writing a state
  that only one route's view reads.

- **A Rust update takes the other arm of a `#[cfg(target_os)]` branch.** Where a
  replaced Rust module runs as wasm (iOS by default; `tiered` or `wasm` mode
  elsewhere), the update is the data crate built for `wasm32-unknown-unknown`,
  whose `target_os` is `"unknown"` and `target_family` `"wasm"` (`rustc --print cfg
  --target wasm32-unknown-unknown`). A `#[cfg(target_os = "ios")]` arm the binary
  ran is gone, and a `not(…)` arm or the `wasm32` one runs in its place. The bake
  accepts the branch, since the source digest reads every arm (LLP 1030 D3a,
  amended 2026-11-12). Branch only on `target_arch = "wasm32"`, as Markdown, Exact
  Live and Update Lab do for what has no worker or thread there. (A crate with
  `macos`, `ios` and `wasm32` arms, built for wasm32, ran the `wasm32` one;
  2026-11-12.)

- **A row cannot own a request.** A component that declares a resource or a
  mutation, used under a `for` over data or in a virtualized `list`, fails with
  `type-child-resource`; it may own them as a screen, a tab or an `if` arm.
  Declare the root's resource over the list, or the mutation in the root, and
  pass each row its answer or an action that sends it.

- **A derive read after the action assigns its input is the old value, with no
  warning.** With `derive count = items.length`, `items = next` then `found =
  count` reads the old list's count. A derive read in an action is the starting
  state's, as a state's read is, but only the state's read is warned of
  (`analyze-read-after-assign`; a derive is a settled value, LLP 1089 D3). Read
  what you assigned (`found = next.length`), and build the next record
  explicitly for a send, for example `DepartureState(current, at=current.at +
  600000, status="Delayed")`. Caltrain's activity update sent "On time" after
  incrementing its delay until it built that next record
  (`apps/caltrain/app.contract`, LLP 1126.001 WP9; expo/exact#649, 2026-11-15).

- **A name refused as reserved.** `none`, `some`, `true`, `false` and the expression
  words (`if`, `for`, `match`, `and`, …) cannot name a state, a parameter or a `let`
  (`syntax-expected-name`); nor can `length` name a function or action in a file
  that reads `.length` (`syntax-method-shadowed`; a shape's field may be
  `length`). Fix: another
  word (`count`, `steps`, `empty`). (euxy port, 2026-10-15.)

- **An action call also names a host command.** `setMode(value)` is ambiguous
  when an action is also named `setMode` (`syntax-call-ambiguous`). Rename the
  action and its bindings, for example to `chooseMode`.

- **A scalar resource cannot use `empty("idle")`.** `empty()` takes named
  fields only for a record shape; a string's `empty()` is `""`. Use a pure
  fallback function for a nonempty string. (`type-placeholder-fields`,
  reproduced while testing TypeScript failure parity, 2026-10-13.)

- **An `every(N, …)` task does not fire at mount.** Its first tick comes `N` ms
  after it starts, so state it fills is empty until then, after a test `reload`
  too: a "today" label or a comparison against it reads the stale or empty
  value. Fix: compute the value in a derive (from the `exactTime` source's
  `time.epochAtZero + performanceNow()`), or set it in the mount action, and let
  the task only refresh it. (Authoring bench, LLP 1087, t5-pomodoro, 2026-10-08.)

- **A marker that moves by `if` costs a view each move.** Symptom: an animation
  that moves a dot, a playhead or a selection ring from cell to cell several
  times a second keeps a phone busier than a hand-built UIKit screen. Cause:
  `if head == 0` around the marker destroys a node in one cell and creates one in
  the next at every move: a view made and dropped, its style applied, and a
  layout. Fix: keep the marker in every cell and move it by `opacity=(head == 0 ?
  1 : 0)` (with `transition="none"` where it must not fade), as a hand-built app
  toggles `alpha` or `isHidden`. Measured on euxy playing (sixty-eight step
  cells, eight moves a second, iPhone 17 simulator): 7.1 → 5.5 % CPU, median of
  four. (euxy CPU work, 2026-10-18.)

- **A token kept in an app data file.** Exact has a secret store, and it holds
  strings, not only keys: grant `secret.keep <name>` and use
  `store.set`/`store.get`/`store.forget` in an answer (the Keychain on Apple,
  origin-readable `localStorage` on the web; unencrypted files retained across
  launches on Linux). **Web refresh and session tokens need a server-set
  HttpOnly, Secure cookie:** follow [web sessions](https://exact.expo.dev/recipes/web-sessions.md). The
  Signal clone kept its signal-cli bearer token in a plain config file because
  `secret.keep` read like the P-256 key store of LLP 1069.005. (2026-10-06.)

- **A superseded send's fetch rejects natively and completes on the web
  build.** A newer `send x = command(…)` replaces the pending one; natively
  (and in the web's wasm module realm) its `await fetch(…)` then rejects with
  a `FetchError` of kind `Aborted` though the request may have been sent,
  while on the web build (the JS target) the reply arrives and is dropped. Clear a busy flag or lock in a `finally`, and don't retry on
  `Aborted` (it would send twice); declare the mutation `queue` when every
  send's reply matters (LLP 1092). Until 2026-10-05 the continuation vanished
  natively, which held the Signal clone's sends forever (build 35).

- **`redirect: 'manual'` shows a redirect natively and hides it on the web.**
  Natively a fetch with `redirect: 'manual'` answers the 3xx with its
  `Location`; in a browser it answers an opaque redirect (status 0, no headers),
  and a `Cookie` header the app sets is dropped. An app's own OAuth sign-in
  that reads the authorization step's `Location` therefore works natively only:
  a web build sends that request from a server (`docs/contract-for-agents.md`,
  "An app's own sign-in screens").

- **An error listener's later fetch reaches the server from the web build
  only.** A fetch that a data module's `error` or `unhandledrejection` listener
  makes after an `await`, in a `.then`, or in its report's reply is sent on the
  web build, where the listener is the page's. Natively, only a plain HTTP fetch
  made in the listener itself is sent. The later one is refused with a line in
  `logs`: `fetch() called outside an answer: it was never run`, or `fetch()
  called after an error event's listener returned` (LLP 1175 D3, D7). On the
  web the listener also hears the whole page, and a request of its own that
  fails uncaught calls it again. Fix: fetch in the listener itself, before any
  `await`, and catch the failure ([recipe](https://exact.expo.dev/recipes/report-errors.md)).
  (Scratch app under `agent macos` and `agent web`, 2026-11-14.)

- **Repeating timers fail in data modules; ambient clocks skip bake.**
  The build refuses direct and literal-bracket calls to `setInterval`,
  `requestAnimationFrame`, and `requestIdleCallback` by file and line, and
  every executor refuses them at runtime (use `setTimeout` inside an answer or
  a Contract `task`). `Date.now()`, `new Date()`, `performance.now()`, and
  `Math.random()` work against the host's deterministic clock and seeded
  substream (LLP 1195.000 D2), but exclude the resource from launch bake and
  SSR caching and log `[ambient-clock]`. Pass `exactTime()` or
  `performanceNow()` from Contract for reactive, baked, or SSR-cached values;
  under Bun unit tests, pass `--preload ./scripts/test-clock-preload.mjs`.

- **An npm package builds, then fails at runtime on sockets or repeating timers.**
  The build checks the app's own modules for forbidden timers; a package's use
  of sockets, repeating timers, or browser globals may only surface when it
  runs. `convex`'s reactive client (`ConvexClient`, `BaseConvexClient`) opens
  its own socket and arms timers no answer owns: use `@exact/convex`
  (`bun exact.mjs docs convex live queries`). For `ConvexHttpClient`, pass
  `{ logger: false }` so its default logger does not draw ambient
  `Math.random()` and exclude the resource from launch bake and SSR caching.
  Drive a new package once (`agent web "clock data" logs`) before building on
  it. (LLP 1157 §1, 2026-11-10.)

- **A drive against a real backend: the second launch's writes are refused or
  ignored.** A write returns a 4xx duplicate-key error (for example,
  `Idempotency-Key` reused) or replies ok without changing data (as on a real
  Convex deployment). Cause: under the driver `crypto.randomUUID()` and
  `crypto.getRandomValues()` draw a repeatable stream from the launch seed
  (`--seed`, `1` by default), so every launch generates the same idempotency
  keys, request IDs, client mutation IDs, or Convex session IDs; `logs` notes
  that random draws are seeded on the first draw. Fix: pass a fresh `--seed`
  per launch (`agent macos --seed 7 …`), or drive against a local stand-in
  (`bun exact.mjs docs convex live queries`). Launches outside the driver draw
  system entropy. (LLP 1157 §6, 2026-11-10.)

- **A sign-out that also fetches leaves Convex signed in.** `cx.setAuth(undefined)`
  and then a `fetch` (an auth provider's sign-out) in one synchronous mutation
  source: the runner refuses it (`a mutation cannot both send on a socket and
  fetch`), so its `Authenticate` never leaves and the socket stays the
  person's. Cause: `setAuth` sends on the socket. Fix: an `async` source that
  awaits the fetch, then calls `setAuth`. The module gives no answer and runs
  no mutation as the wrong person meanwhile (`bun exact.mjs docs convex live
  queries`). (expo/exact#54, 2026-11-12.)

- **An upload of a picked file under the agent fails only when it runs.** The
  `pick` succeeds, and the upload's `exactBodyFrom app:/…` fails with `storage
  is unavailable in agent mode unless the drive names a scratch store`: a
  picked file is a copy in app storage, which a web drive has only with
  `--storage <name>`. Fix: name one on any drive that uploads what it picks.
  (expo/exact#54, 2026-11-12.)

- **A helper action does not see what its caller just assigned.** `sel = next`
  then `follow()`, with `follow` reading `sel`, would read the old `sel`: a call
  is its callee's statements in the caller's one commit, and every statement
  reads the state the action started with (LLP 1089 D2). The compiler warns of
  the read (`analyze-read-after-assign`, naming both lines; a warning since LLP
  1035.005.002 C2, as the same read in the action's own body is). Fix: pass the
  value the helper should see, `follow(next)`, or a `let` bound before the
  assignment for the old one. (Spreadsheet F21 and Files F27 diaries, where a
  copied block was the workaround.) In the action's own body the same read is
  the same warning: `now = performanceNow()` then `if now >= endsAt`
  tests the last tick's time (focus-timer's phases changed 250 ms late in two
  bake-off rounds). Fix: `let stamp = performanceNow()`, `now = stamp`, and read
  `stamp`.

- **A delete or save is lost when the page reloads right after it.** An action that
  `send`s a write and navigates away in the same commit passes every test, but a
  browser reload in the next ~100 ms comes back without the write. Cause: the write
  is the data module's, and it is done only when its mutation answers; the reload
  ends the page first. Fix: navigate in the mutation's `then`, which runs once the
  write has answered. (Authoring bench, LLP 1087, a2-contacts and t2-todo, 2026-10-05.)

- **Import a module event where its attribute is written.** After `use reading
  as tagEvent from "@exact/nfc"`, write `main tagEvent=tagRead` on the root.
  The attribute uses the imported name; `reading=` is unknown unless imported
  under that name too. A local state, derive, action or loop binding named
  `reading` does not hide the imported event from an attribute.

- **Repeating with `pause` mutations.** A `then` cannot send its own mutation
  (`analyze-then-self-send`), and two mutations whose `then`s send each other
  are the same loop. To repeat while a condition holds, use a task with `when`
  and `every`. See "Repeating while a condition holds" in the guide.
