# Accumulate independent errors before writing output

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

Free workshop: [how to burn a trillion tokens and get good results](/tokenmaxx#interested).

Effect 4's [`Effect.validate`](https://github.com/Effect-TS/effect/blob/effect%404.0.0/packages/effect/src/Effect.ts#L594-L651) evaluates every collection element.
It returns all failures as a non-empty array when any element fails.
Successful values are discarded in that case.

The [code-snippets design brief](/lore/code-snippets) uses this operation for preflight.
Each snippet is an independent job.
A job stops when a dependent stage fails.
Other jobs still run.

The proposed order is:

1. Collect snippet jobs.
2. Check every job.
3. Report each failure with [diagnostic context](/lore/errors-are-part-of-the-interface).
4. Write assets only when preflight succeeds.

This is error accumulation across jobs.
It does not run highlighting on an invalid request.

The planned property inserts exactly `k` independent failures.
It expects exactly `k` diagnostics and zero asset writes.
See [property-based testing](/lore/property-based-testing) and [the glossary](/glossary).

## Sources

1. [Effect.validate](https://github.com/Effect-TS/effect/blob/effect%404.0.0/packages/effect/src/Effect.ts#L594-L651)
   Effect contributors. Collection failure semantics Accessed 2026-10-02.

2. [Effect.validate test](https://github.com/Effect-TS/effect/blob/effect%404.0.0/packages/effect/test/Effect.test.ts#L1167-L1173)
   Effect contributors. Collected failures Accessed 2026-10-02.

## Linked from

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Build-time work stays out of requests → Git reads and highlighting produce static assets before the Worker handles requests. → [Read page](https://ratstack.sh/lore/build-time-work-stays-out-of-requests)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Code snippets quote a pinned source → Design brief for a build-only code pipeline: pinned Git objects, typed diagnostics, and one snippet model for both views. → [Read page](https://ratstack.sh/lore/code-snippets)

- Errors are part of the interface → An author error needs a location, the rejected input, and a repair. → [Read page](https://ratstack.sh/lore/errors-are-part-of-the-interface)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- log.md → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)

- Rat Stack lore | rat-stack → Short, source-grounded notes on the ideas and decisions behind rat-stack. → [Read page](https://ratstack.sh/lore)

## Unlinked mentions

- [Code snippets quote a pinned source](https://ratstack.sh/lore/code-snippets) → No asset writer runs before successful preflight.¶
