AI, fully local on your computer.
TypeScript aiai-toolskiwixllama-cpplocal-ailocal-llmofflineoffline-aioffline-firstprivacy-firstragwikipediazim
docs: the "could not start" card, what helps, the start's failure contract (#1024)
comilionas4776e6f70e44
diff --git a/BUILD_STATE.md b/BUILD_STATE.mdindex 97a58f65..d9390de7 100644--- a/BUILD_STATE.md+++ b/BUILD_STATE.md@@ -28,6 +28,7 @@> entries were true when written but are snapshots — as of 2026-07-10 `master` is pushed (in sync> with origin through `ac4f315`) and the 2026-06-30 audit branch stack is merged. Only the branches> named in §5's branch analysis still carry unmerged work.+_2026-11-23 — **#1024 (a back-end start that throws; branch `fix/1024-backend-start-failure`, on `6c2fc2c8`): in review.** `initBackend` runs through `runBackendStart`: a throw logs its code (no path), drops the channels the partial start registered and registers the failure state, so `getWorkspaceState` answers `start_failed` (a cause + the code) and the gate shows "The app could not start", what helps, the code and "Copy details for support". Review round 1: a masked mkdir errno is read again, a throw after the back end shows an error box and exits, the crash lines log codes. Owner calls 2026-11-23: OQ-1 (b) the copy button, OQ-2 (b) three texts. Records: data-contracts "Start failure (#1024)" (P6: the update registrar takes the narrow failure context), security-model, troubleshooting, known-limitations. Dev app: as designed; the card's text waits two frames. Open: the German read; a Narrator listen; Electron's handler swap after a late throw; review.__2026-11-22 — **#1027 (a v1 → v2 password change whose staged database cannot be moved into place; branch `fix/1027-password-change-failed-swap`, on `838a31f2`): in review.** The open session now wins: the change drops the stage from the rekey journal, saves `.enc` from the open database under the new key and deletes the stage; every lock of the session retries what is left; an unlock removes a stage that opens under the data key beside an `.enc` that opens too (`superseded`). A failed rollback no longer hides the change's own error or skips zeroing the new key. Owner calls 2026-11-22: OQ-1 (a) a log line and docs, no notice; G-1 refined as recommended. Records: security-model "Password change" + the #973 rule, data-contracts (rekey journal, `superseded`, the frozen constraint), known-limitations. Open: residuals R1–R3 (known-limitations); review.__2026-11-22 — **#1015 + #1014 (the rekey journal at the start; PR #1030): merged 2026-11-22 (`838a31f2`).** A swap a held file stops now blocks the recovery (`vault_recovery_blocked`, "try again", the code logged) instead of throwing out of `init()` before the IPC, and a folder in the way is left aside, never a block (but at `.enc`); the journal acts only inside the workspace folder on the disk (no link on the way), is rewritten to what still waits, the rotated log by its computed path, out-of-store stages outside the folder (or reached through a link) at the unlock when the database lists them and the stage opens under the data key; the shreds never write through a link or a hard-linked file; a folder at `.enc.new` no longer replaces `.enc` nor costs the only copy (owner calls 2026-11-22: D1 (a), D2 (a); reviews: Fable, `/code-review high`). Records: `security-model.md` "Password change" + "Secure erase", `data-contracts.md` rekey journal. Follow-ups: #1024 (a failed backend start leaves the window with no IPC), #1027 (a v1 → v2 change whose staged database cannot be moved into place).__2026-11-22 — **#1012 (the pre-spawn check covers every file the engine copy's marker records, not only the program; PR #1029): merged 2026-11-22 (`6a5ea85c`).** A changed or missing program or library refuses the start with the #532 `files-damaged` verdict and the "Install again" offer (a changed file is still logged as a possible tamper; the graphics probe answers no result, never "no card"); a file that cannot be read just now is `unreadable`: never cached, nothing blamed or latched, and chat, translation, audio import, dictation and image questions say so (`main.engine.filesUnreadable`, 10 catalogs). Owner calls 2026-11-22: Q1 (a) any recorded file missing → refuse + reinstall offer; Q2 (b) the knowledge-pack tools log a missing unused file and start; Q3 (a) the unrecorded-library gap documented. Reviews: Fable, `/code-review high` ×4. Records: security-model.md "Re-hash sidecar binaries before spawn", architecture.md "Engine load failures" §13, data-contracts.md, known-limitations.md, troubleshooting.md. Open: the owner's German read of `main.engine.filesUnreadable`; follow-ups #1025 (an unrecorded library, the engine's working directory), #1026 (the Visual C++ text after a fresh install), #1028 (a marker that does not parse); #1013._diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 63077610..17c4d16c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,6 +27,13 @@ from its first public `1.0.0` release onward.### Fixed+- **When HilbertRaum can't start, it now says why and what to do.** If the app could not write to its drive (for+ example a USB stick or SD card with its lock switch on), the drive was full, or something else stopped the start,+ the window showed only "The app could not start" with a technical message, and told you to look in a log file that+ isn't on the drive before you unlock. It now says what happened in your language, what helps (make the drive+ writable or free some space, then start the app again), and the error code, and its **Copy details for support**+ button copies the details for a support request. If the app's window itself could not open, the app kept running+ invisibly and every new start did nothing; it now shows a message box and closes (#1024).- A plain question that only contains a word like "listed", "reviewer", "preview", "registration", "analyst" or«Briefkasten», "When is the rent review?" or "How many minutes notice must be given?" is answered from the fewpassages that match, as for any other lookup, instead of reading the whole document (#997).diff --git a/docs/architecture.md b/docs/architecture.mdindex 20f2204d..3db9502b 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -6954,7 +6954,8 @@ one, and each glossary is pinned on top of its catalog file.locale from `useT().lang` (`useGrouping: false` keeps English output byte-identical tothe old `toFixed`).- Inline JSX islands (`<code>`, `<strong>`) use before/after key pairs- (`app.fatal.hintBefore/After`).+ (`diag.logs.hintBefore/After`; the fatal screen's `app.fatal.hintBefore/After`, around `logs/app.log`, went with+ #1024).- **A label and its value, a figure and its unit, and a figure and its percent sign are joinedthe language's way, never by code** (open-issues wave, #804, 2026-11-14; open-issues wave ownercalls G-3, G-4). A `": "` or `" — "` typed between a label and its value, or a plain spacediff --git a/docs/data-contracts.md b/docs/data-contracts.mdindex b392beea..6d9e9cc8 100644--- a/docs/data-contracts.md+++ b/docs/data-contracts.md@@ -1698,10 +1698,11 @@ re-reads them. An older app ignores both keys and keeps rule C on the derived esway, or document work in progress: `VaultBusyError`, whose message is `tMain` text since #807), `error` (anything else, #845's refusalsincluded: the current password still works). Registered in `initBackend()`; exposed on preload `api` +`PreloadApi`.-- **Types** (`shared/types.ts`): `WorkspaceStateName` (`uninitialized|locked|unlocked`),- `WorkspaceStateInfo { state, mode, plaintextAllowed, encryptionRequired, lockNotice? }`+- **Types** (`shared/types.ts`): `WorkspaceStateName` (`uninitialized|locked|unlocked|start_failed`; the last, #1024,+ only from the start-failure state below, never from the controller),+ `WorkspaceStateInfo { state, mode, plaintextAllowed, encryptionRequired, lockNotice?, startFailure? }`(`lockNotice`: `working_copy_lost` | `session_not_closed` | `session_not_closed_full`, #892;- `encrypted_file_missing`, #911),+ `encrypted_file_missing`, #911; `startFailure`: `BackendStartFailure`, #1024),`WorkspaceActionResult`.✅ **`AppContext.db` is now a getter** over `workspace.requireDb()` (throws while locked) +`AppContext.workspace: WorkspaceController`. `main/index.ts` builds the controller from@@ -1713,6 +1714,37 @@ re-reads them. An older app ignores both keys and keeps rule C on the derived esvs plaintext choice when policy allows, confirm + strength hint, wrong-password error). `App.tsx`fetches `getWorkspaceState()` on mount and renders the gate until `unlocked`; sidebar **Lock now**button (encrypted only) calls `lockWorkspace`. The Settings workspace card reflects the real mode.+✅ **Start failure (#1024)** — `main/backend-start.ts` `runBackendStart(initBackend, …)`. A back-end start that throws+ (`initBackend` registers every channel at its end) logs one line, `Backend initialization failed` with+ `safeFailureForLog` (a file error's code and bare system call, never its message; `{ "error": "unreadable" }` for a+ value it cannot read, and then the failure is `{ cause: 'other', code: null }`), removes every handler the partial+ start registered (`releaseGuardedHandlers`, `ipc/guarded-handle.ts`; their count is logged when there were any), and+ registers the failure state+ (`ipc/registerStartFailureIpc.ts`, which takes a `StartFailureContext { trustedSenders, failure, paths, isDev }` and no+ `AppContext`):+ - `getWorkspaceState` → `{ state: 'start_failed', mode: null, plaintextAllowed: false, encryptionRequired: true,+ startFailure }`, with `startFailure: BackendStartFailure { cause, code }` (`services/start-failure.ts`): `cause` is+ `drive_not_writable` (`EROFS`, `EPERM`, `EACCES`, SQLite 8 READONLY) | `drive_full` (`ENOSPC`, `EDQUOT`, SQLite 13+ FULL) | `other`; `code` is an errno code, a Node `ERR_…` code, `SQLITE_<n>`, or null, never free text (a `code`+ property of any other shape, or longer than 40 characters, reads as null). No message, no path.+ - `getLogTail` and `writeClipboard`: "Copy details for support", the same pair Diagnostics' Copy uses+ (`ipc/log-copy.ts`), with the same #975 redaction.+ - Every other `handle` channel has no handler: Electron refuses the invoke ("No handler registered for '<channel>'",+ the channel only). The renderer calls nothing else in this state (the engine-problems read takes the refusal).+ The gate (`WorkspaceGate.tsx`) shows the card for `start_failed`: the cause's text from `START_FAILURE_KEYS`+ (`shared/workspace-failure-keys.ts`, own-property read; an unknown cause reads as `other`), "Error code: {code}" when+ there is one, and the copy button. `index.ts` installs the offline tripwire after a failed start, always offline.+ **Constraint for the update plan (W-82, P6 task T6.3):** F-14's update channels (and P7's hand-off channel) are+ registered inside `registerStartFailureIpc`, so a release that cannot start can still take the update that repairs+ it. Their registrar takes a narrow context built from `StartFailureContext` (the senders, the drive root from+ `paths`, `isDev`, the app version), **never the full `AppContext`**: that context does not exist in this state, and+ the same registrar call serves the normal start. P3's `update.log` line (W-14) goes in `runBackendStart`'s catch,+ `failure.cause` and `failure.code` only.+ **After the back end (review M-2):** the app protocol, the menu and the window start inside `runWindowStart`+ (`main/backend-start.ts`). A throw there logs `App start failed after the back end` (`safeFailureForLog`), shows+ `dialog.showErrorBox(tMain('app.fatal.title'), tMain('gate.startFailed.other') + '\n\n' + tMain('gate.startFailed.help'))`+ (fixed text, never the error), runs the emergency lock and `app.exit(1)`: no windowless process keeps the+ single-instance lock.### Real runtime + embedder (Phase 10 live)✅ **`services/runtime/sidecar.ts`** — discovery + `LlamaServer` lifecycle.diff --git a/docs/design-guidelines.md b/docs/design-guidelines.mdindex c932f4e8..fe626c97 100644--- a/docs/design-guidelines.md+++ b/docs/design-guidelines.md@@ -367,7 +367,8 @@ The current dark palette survives as the dark theme (lightly tuned per §4.3).Plain, calm, second person, present tense. Describe the problem and the next step; errorcodes only in Diagnostics. No exclamation marks or humor in failure states. No jargon in-the everyday path.+the everyday path. (One exception, #1024: the gate's "The app could not start" card shows the+error's code on a quiet line under the text, because Diagnostics cannot be reached from it.)| Before | After ||---|---|diff --git a/docs/known-limitations.md b/docs/known-limitations.mdindex 6cb1dbf5..cd2866ba 100644--- a/docs/known-limitations.md+++ b/docs/known-limitations.md@@ -275,6 +275,38 @@ password recovery — are documented inand could not lock the workspace either (the drive still full).A line in the log says when the change could not move its copy into place. Unlocking once withthis version, after the other program lets go of the file, removes the leftover.+- **A start that fails shows "The app could not start", and some of it is owed a real-app check (#1024).**+ A back-end start that throws (a drive that refuses the app's folders, a full drive, a fault in this version) shows+ the gate's failure card with the cause and the error code. What is left:+ - On an encrypted workspace the failure's log lines live in memory only, so they are gone when the app closes:+ "Copy details for support" is the way to keep them. The update plan's `updates/update.log` will record the+ failure's class on the drive (when the drive can be written).+ - A write-protected card or a read-only mount: Node's recursive folder creation reports any refusal other than+ EACCES, ENOSPC, ENOTDIR and EPERM as the ENOENT of the check it makes next (review M-1, measured with an invalid+ name and a dangling link), so the app makes one plain attempt at the folder to read the real error (`EROFS`, "can't+ write to this drive"). That a lock-switched card answers `EROFS` is read from libuv's source (Windows'+ ERROR_WRITE_PROTECT), not measured on a real card. Only when the drive's root folder itself is missing on such a+ medium does the card still show `ENOENT` and the general text. With all four folders present such a drive starts,+ and the unlock fails instead (`main.workspace.openFailed`).+ - There is no "Try again" on the card: starting the app again is the retry.+ - The help line and the fatal screen point at the troubleshooting guide in the drive's `docs` folder. A drive+ prepared for HilbertRaum has one; the app-data folder a standalone install falls back to does not, and the guide+ is in English only.+ - A throw after the back end's start (the app's own renderer files, the menu, the window) has no window to show the+ card in: the app shows a native error box with the card's title and its general text in main's language (the+ computer's language before an unlock), logs the error's code, and ends (review M-2). A throw before the app is+ ready (in the main module itself) still ends with Electron's own error dialog.+ - A throw late in the back end's start (after some of its services were built or started) leaves that half-started+ back end running behind the card (review L-2): on a plaintext developer workspace its database stays open until+ the quit, and on a locked Kit nothing it built is reachable (no channel answers but the card's). The quit's+ teardown stops and closes what the context (`ctx`) holds by then; the log says how many channels the start had+ registered when it threw.+ - Measured in the dev app (a drive root that refuses new folders): the state, the code (`EPERM`), the log line+ without a path, "Copy details for support", the other channels refused by Electron, and the card's text arriving+ two frames after its alert region (an effect alone had put both in one frame, the #436 trap; the text now waits+ two animation frames). Still owed: a by-ear Narrator listen of the card, and Electron's own removal and+ re-registration of handlers after a throw that comes after some registrations (the dev app's start failed before+ any; the rows use the IPC harness, which models Electron's refusal of a second handler).- **Shredding never follows a link, so it cannot reach a file another name shares (#1014).** Asymbolic link, a junction or a file with more than one hard link at a name the app shreds isonly unlinked: a plaintext file someone hard-linked keeps its bytes under the other name. Mounts@@ -3904,9 +3936,11 @@ Accepted as-is, with reasons:- **Hairline `--border` separators are ~1.3:1.** They are decorative row/card separators,never the sole identifier of a component (cards pair them with surface fill + shadow;inputs use `--border-strong`). WCAG 1.4.11 applies to required boundaries only.-- **The fatal "app could not start" screen shows the raw error string.** §7 keeps error- codes inside Diagnostics, but when the backend never came up Diagnostics is unreachable —- the raw string (plus the log pointer) is the only diagnostic the user can relay.+- **"The app could not start" shows an error code, and its last-resort form a raw error string.** §7 keeps error+ codes inside Diagnostics, but when the back end never came up Diagnostics is unreachable. Since #1024 a start that+ throws shows the gate's card with the error's code alone (`EPERM`, never a message or a path) and "Copy details for+ support"; the fatal screen, now only for a failure state that could not be registered either, still shows+ Electron's IPC error string (it names only the channel) and no longer points at `logs/app.log`.- **The Documents screen's per-row selection checkbox is 16px** (#151 KL-2: numbersrefreshed — 16px in a 56px row). Under the 24px target minimum, but WCAG 2.5.8 issatisfied via the spacing exception: the tall row means no other target falls within thediff --git a/docs/security-model.md b/docs/security-model.mdindex f4306273..323b33b7 100644--- a/docs/security-model.md+++ b/docs/security-model.md@@ -509,7 +509,9 @@ AI Model screen uses the same distinction to explain why downloads are unavailab### 2. Startup self-check (`services/offlineGuard.ts`)At startup (`initBackend()`), `assertOfflinePosture()` logs the offline posture and installs a defensivetripwire over `net.Socket.prototype.connect` for the whole session, in **all builds** (so a production-regression that tried to phone home would still be recorded locally). While the app is offline, any+regression that tried to phone home would still be recorded locally). It is `initBackend`'s last step, so a start that+throws never reaches it: since #1024 `main/index.ts` installs it after such a start too, with a posture that always+reads offline (the failure state has no workspace to ask, and nothing in it may reach the network). While the app is offline, anyconnection to a **remote** host from the main process is logged as a violation, by whichever route itreached a socket: `fetch`, `http.request`, `net.connect` and TLS alike. (Until #751 only TLS was seen: theothers pass Node's normalized argument array, which the guard did not read, so their host came back empty@@ -809,7 +811,11 @@ matching the unencrypted dev DB.**Workspace failure lines name no path (#956).** Diagnostics → Copy and Save log hand the log outin readable form, so the workspace's failure lines carry no paths: the create's content-free line(#807) is the rule for every failure line of the unlock, the password change, the lock and the quit-teardown (`main/shutdown.ts`), through `failureForLog` (`services/failure-for-log.ts`). A Node file+teardown (`main/shutdown.ts`), and (#1024) of the back end's start and the window's (`main/backend-start.ts`: "Backend+initialization failed", "App start failed after the back end") and of the uncaught-exception and unhandled-rejection+lines (`main/index.ts`), which all logged `String(err)` before, through `failureForLog` (`services/failure-for-log.ts`);+those four through `safeFailureForLog`, which never throws and logs `{ "error": "unreadable" }` for a value it cannot+read (a `String()` of an object with no prototype threw, and in the crash handler skipped the emergency lock). A Node fileerror, one with a `syscall`, `path` or `dest`, or with an errno code (`E…`) or a Node `ERR_FS_*` codealone (a `cpSync` refusal carries only that), logs its kind, code and system call, never its message,which names the drive's or the user profile's paths. The system call is kept only as a bare name: a@@ -894,7 +900,11 @@ therefore runs as a three-state machine (`services/logging.ts`):boundary). **Nothing touches disk.** Lines logged before the user authenticates are lost if theapp is killed while still locked — a deliberate trade for "no sensitive bytes on disk beforeunlock." The same applies to a session spent entirely at the unlock gate (never unlocked): it- stays in `buffering` and is discarded on quit.+ stays in `buffering` and is discarded on quit. So does a run whose back-end start threw (#1024; also a+ throw before `initLogging`, which is the module's initial state): its failure line is in this buffer only, and the+ start-failure card's "Copy details for support" hands it out through the same `getLogTail` as Diagnostics' Copy,+ redacted (#975). Nothing writes it to the drive in plaintext; only a plaintext developer workspace that the start+ had already opened appends it to its plain `app.log`, as it does every line.- **`encrypted`** (after `attachVaultKey(key)`, called from the unlock/create IPC path): the bufferis folded together with any persisted history decrypted from `app.log.enc`, then re-sealed. Newlines append to the in-memory buffer; the `.enc` snapshot is rewritten **on every `error`**diff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex f588b3d9..b56ac052 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -941,6 +941,41 @@ right after.---+## "The app could not start"++HilbertRaum shows this when it could not finish starting (#1024). Nothing can be opened in this run,+so the screen has no password field. Under the title it says what went wrong and what helps:++- **"HilbertRaum can’t write to this drive"**: at the top of the drive the app needs its folders+ `workspace`, `models`, `logs` and `config`, and the drive refused to create one. Check that the+ drive isn’t write-protected: some USB sticks and SD cards have a small lock switch on the side. On+ Windows, check that your account may create folders there (right-click the drive or the folder →+ **Properties → Security**: "Create folders / append data" must not be denied). On Linux or macOS,+ check that the drive isn’t mounted read-only and that you can write to it. Then start the app+ again.+- **"The drive is full"**: free some space on the drive, then start the app again.+- **"Something stopped HilbertRaum while it was starting"**: check that the drive is still+ connected and that it can be written to, then start the app again.++The **error code** under the text says more:++| Code | What it means |+|---|---|+| `EPERM`, `EACCES`, `EROFS` | The drive refused the write: a lock switch, an access rule, a read-only mount. `EPERM` and `EACCES` can also come from a security program that guards folders (for example Windows **Controlled folder access**, or an antivirus): allow HilbertRaum there, or start it from a drive the program does not guard. |+| `ENOSPC` | The drive is full. |+| `ENOENT` | The drive, or the folder the app was started for, is not there any more (a stick pulled out while the app started, a drive letter that no longer exists). |+| `EEXIST`, `ENOTDIR` | A file sits where one of the app’s folders (`workspace`, `models`, `logs`, `config`) should be. Rename or move that file. |+| `SQLITE_…` | A developer workspace that is not encrypted could not be opened. |+| Anything else, or no code | Most likely a fault in this version of the app. Start it again; if it keeps happening, report it with **Copy details for support**. |++**Copy details for support** copies this run’s log lines, the same lines **Settings → Diagnostics+(advanced) → Recent logs → Copy** hands out, with your drive and home folder shown as `<drive>` and+`<home>` (see "Where are my data and logs?" below). Paste them into your support request. On an+encrypted workspace these lines exist only while the app is open: nothing is written to `logs/`+before an unlock, so copy them before you close the app.++---+## The app won't start from the drive- Use the **launcher** at the drive root (`Start HilbertRaum`) rather than opening the@@ -966,7 +1001,8 @@ right after.when that happened: if the app quits right away every time on this Mac, delete the folder namedafter the zip in `~/Library/Caches/HilbertRaum/` the same way.- Check that the drive has free space and is writable. The app shows a friendly note on the Home- screen if the drive is read-only, low on space, or slow (none of these block you).+ screen if the drive is read-only, low on space, or slow (none of these block you, except a drive+ the app cannot create its folders on: see **"The app could not start"** above).- If the drive was just prepared, confirm `config/drive.json` exists at the drive root.---@@ -1371,7 +1407,9 @@ Everything is on the drive:as `<user>` too. The rest of each path stays, so support can still see which file failed(`<drive>\runtime\llama.cpp\win\llama-server.exe`). A name in an unusual place can remain, forexample in a folder you named yourself, so read a log before you share it. The log on the drive- keeps the full paths.+ keeps the full paths. On an encrypted workspace, the lines from before you unlock are kept in+ memory only and are gone when the app closes without an unlock: no log reaches the drive before+ you have typed your password.- `models/` — model weights. `config/` — drive settings/policy, and `workspace.json`, which holdsyour encrypted workspace's key (encrypted under your password): it belongs with `workspace/`.