Waleed 936e1acfd8 fix(knowledge): say what went wrong when a document's chunks fail to load (#6858)
* fix(knowledge): say what went wrong when a document's chunks fail to load

`combinedError = documentError || searchError || initialError` collapsed three
different failures into one, blanked the rows and stripped search, sort and
filter — and said nothing. A failed read rendered as an empty table, which is
the same thing the page shows when a document genuinely has no chunks.

Stripping the search box was the worse half: when it was the *search* that
failed, the control the user needed to clear it was the one that disappeared.

The three are now told apart:

- The document itself failing has no page left to draw, so it gets a full
  screen, matching the base page's 'Knowledge base not found' one level up.
  It has to run before the editor branches — `selectedChunkId` renders the
  chunk editor without checking for a document, so a deep link to a chunk of a
  deleted document sat on 'Loading chunk…' forever.
- A failed chunk read keeps the document, so it keeps the chrome and the
  controls, and the message goes in the table body through the `emptyState`
  slot. Tinted with the error token, because at the weight the empty states use
  a failure is indistinguishable from 'nothing here yet'.
- A failed search leaves the loaded chunks intact, so it says the search
  failed rather than claiming the chunks could not be loaded.

`searchError` went through `instanceof Error ? .message : null`, so a rejection
that was not an `Error` produced no message and fell back to the silent blank
this commit exists to remove. It uses `getErrorMessage` now, like the chunk
read beside it always did.

Pagination is dropped on a failed read — it was counting pages nothing fetched
— and the action bar reads the same value, so it no longer lifts itself clear
of a bar that is not there.

The not-found screen was about to be copied a second time, so it moves to
`ResourceNotFound` and the base page adopts it.

* fix(knowledge): let a processing document say so, not that it failed

A document that is not `completed` rejects the chunk read by design —
`requireChunkReadable` throws `KnowledgeDocumentNotReadyError` before it queries
anything — so `initialError` is set for every pending, processing or failed
document. Treating that as a load failure put "Couldn't load chunks" over a
document that is simply still working.

`chunkRows` already builds the right row for those states, and it turns out
nothing could ever see it: the old `combinedError` blanked the rows on exactly
the same condition, so "Document processing pending..." has been unreachable
for as long as it has existed. Excluding not-ready documents from `chunkError`
brings the row back and leaves the error state for reads that genuinely failed.
2026-08-19 13:20:54 -07:00

Sim.ai Documentation Slack X

Ask DeepWiki Set Up with Cursor

Sim — Integrate, Context, Build, and Monitor AI agents

A workspace to build, deploy and manage AI agents and workflows.

Quickstart

Cloud-hosted: sim.ai

Open sim.ai

Self-hosted

git clone https://github.com/simstudioai/sim.git && cd sim
bun install
bun run setup

Open http://localhost:3000

The Sim platform — chat on the left, the visual workflow builder on the right

Capabilities

  • Connect 1,000+ integrations and every major LLM
  • Add Slack, Notion, HubSpot, Salesforce, databases, and more
  • Build agents visually, conversationally, or with code
  • Ingest files, knowledge bases, and structured table data
  • Monitor runs, logs, schedules, and workflow activity

One workspace, every surface

Chat and workflows are just the start — tables, files, and knowledge all live in the same workspace.

Tables in Sim — structured data your agents can query

Tables — a database, built in

Files in Sim — documents for your team and every agent

Files — one store for your team and every agent

Knowledge bases in Sim — synced docs your agents can search

Knowledge — your agents' memory

Self-hosting

Requirements: Bun and Docker.

bun run setup is an interactive wizard: it provisions the database, generates secrets, writes your .env files, connects a Chat API key, and starts Sim the way you choose:

  • Local dev — run from source to contribute or hack on Sim
  • Docker Compose — a self-contained instance for testing self-hosting
  • Kubernetes (Helm) — deploy to a local cluster

When it finishes, open http://localhost:3000.

Reconfigure an optional capability without rerunning the full wizard:

bun run setup status
bun run setup email
bun run setup storage
bun run setup sandbox
bun run setup jobs
bun run setup cache
bun run setup knowledge
bun run setup llm
bun run setup integration slack

bun run setup status detects the effective local-dev, Docker Compose, or current-context Helm configuration and reports configured, missing, or invalid capabilities and OAuth integrations without printing credential values. This is separate from bun run sim status, which reports whether installed services are running and healthy.

Manage your install with bun run sim:

bun run sim start | stop | restart   # bring your install up / down / cycle
bun run sim update                   # pull/rebuild and apply Compose images
bun run sim status                    # what's installed and healthy
bun run sim logs                      # follow logs
bun run sim doctor                    # diagnose configuration problems
bun run sim down                      # remove containers (data kept)
bun run sim reset                     # archive .env and wipe managed data

sim detects how you're running (Docker Compose, local dev, or Kubernetes) and acts accordingly.

Prefer a bare sim? Run bun link once — but note sim lands in ~/.bun/bin, which Homebrew's bun doesn't add to your PATH, so you may need export PATH="$HOME/.bun/bin:$PATH" in your shell profile.

Sim also supports local models via Ollama and vLLM. See the self-hosting docs for details.

Chat API Keys

Chat is a Sim-managed service. bun run setup connects a Chat API key for you — sign in when it opens your browser and the key is stored automatically. To view, create, or revoke keys later, go to sim.ai/selfhost/settings/chat-keys.

Environment Variables

See the environment variables reference for the full list, or apps/sim/.env.example for defaults.

Tech Stack

Next.js · Bun · PostgreSQL · Drizzle · Better Auth · Tailwind — and the rest of the stack

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Built by the Sim team in San Francisco

Languages
TypeScript 77%
MDX 20.8%
JavaScript 1.9%
CSS 0.1%