effect
4.1.4 · 11 Nov 2026MIT66.6M / weekRepositoryHomepagenpmAtom feed
4.1.5 is the newest release of 4.x.
In short
12 breaking11 new5 faster56 fixed
- Breaking
Custom
MessageStorageimplementations must adddeleteProcessed. - Breaking
SQL message storage on MySQL needs MySQL 8.0.1+ or MariaDB 10.6+, and
binlog_formatROWorMIXED. - Breaking
Toolkit.WithHandler.handletakesSchema.Jsonparams. Direct callers pass the JSON encoding, withnullinstead ofundefinedfor optional parameters. - Breaking
With
disableToolCallResolution: true, tool callparamshold the JSON encoding and are typedSchema.Json. Provider-executed tools keep the provider's payload. - Breaking
Restrict the MCP Skills extension to protocol 2026-07-28.
McpServerno longer declares or serves it on earlier revisions, andMcpClientfails withUnsupportedErrorwhenextensions: { skills: true }is paired with an earlier protocol. - Breaking
OtlpTracerandOtelTracernow leave the span status Unset instead of Ok when a span succeeds, or fails without a reportable error.OtelTracerno longer overwrites a status set directly on the span in those cases. - Breaking
A
Tool.dynamictool without asuccessschema must return a JSON value, even whentoModelOutputreplaces the model payload. Other values, such as aDate, now fail withToolResultEncodingError. Declare asuccessschema, for exampleSchema.Date, or return a JSON value. Declaresuccess: Schema.Voidfor a dynamic tool that returnsundefined. - Breaking
encodedResultof aSchema.Voidtool, includingTool.makewithout asuccessschema, is nownullinstead ofundefined.
Release note
Patch Changes
Add
Rational, an exact fraction type alongsideBigDecimal, withSchema.RationalandSchema.RationalFromString.import { BigDecimal, Rational } from "effect" const third = Rational.makeUnsafe(1n, 3n) Rational.equals(Rational.multiply(third, Rational.fromBigInt(3n)), Rational.fromBigInt(1n)) // true Rational.toBigDecimal(third, { scale: 3 }) // BigDecimal 0.333Add experimental AG-UI protocol support to
effect/aithrough the newAgUiSchema,AgUi, andAgUiServermodules, and akeepAliveoption toHttpApiSchema.StreamSse.Add
CommandSpec, a lossless projection of aneffect/clicommand path for documentation tooling, plusFlag.annotate/Argument.annotate/Param.annotatefor attaching custom metadata to parameters.import { Config, Context, Option } from "effect" import { Command, CommandSpec, Flag } from "effect/cli" const EnvVar = Context.Service<never, string>("app/EnvVar") const push = Command.make("push", { dbUrl: Flag.String("db-url").pipe( Flag.withFallbackConfig(Config.String("DB_URL")), Flag.annotate(EnvVar, "DB_URL") ) }) const cli = Command.make("app").pipe(Command.withSubcommands([push])) const spec = Option.getOrThrow(CommandSpec.resolve(cli, ["app", "push"])) for (const flag of spec.flags) { // flag.scope, flag.required, flag.fallbacks, Context.getOption(flag.annotations, EnvVar), ... }Fix Bash and Zsh CLI completions for subcommand names containing
:, such astest:unit.Fix CLI completion descriptors marking variadic arguments without a positive minimum as required.
Shell completions keep suggesting repeatable flags, such as
Flag.atLeastandFlag.KeyValuePair, after their first use.Allow
Command.validateto fail with your own errors, whichCommand.runreports like handler failures instead of showing help.Command.withHandlernow keeps the command's existing error type, so errors from earlier validations are not lost. When it replaces a handler, the old handler's errors also stay in the type. Code that annotates such a command with a narrower error type must widen the annotation, or pass the final handler toCommand.makeinstead.Add experimental Cloudflare Cluster support with durable entities, workflows, queues, singletons, and optional Alchemy deployment, plus Effect hooks for keep-alive, durable clocks, and dead-letter detection.
Fix
ClusterWorkflowEngineturning transient storage failures while starting a child workflow into a parent workflow defect; they are now retried.Fix transient storage read errors permanently failing
ClusterWorkflowEngineworkflows that await aDurableDeferred.Add
MessageRetention.maketo delete a persisted entity's old completed requests, and fix@effect/sql-mysql2not starting a transaction for aSET TRANSACTIONBeginTransaction.Custom
MessageStorageimplementations must adddeleteProcessed.SQL message storage on MySQL needs MySQL 8.0.1+ or MariaDB 10.6+, and
binlog_formatROWorMIXED.
Fix
HttpMiddleware.corscalling theallowedOriginspredicate withundefinedfor requests without anOriginheader.Fix
Csv.decodeandCsv.decodeStringdropping records completed before aCsvErrorin the same input chunk.Preserve the supplied time zone identifier in
DateTimenamed zones, including aliases such asEurope/KyivorEtc/UTC, instead of the identifier Intl resolves them to (Europe/Kiev,UTC).Fix
HttpServerRequest.streamfailing on requests with no body; return an empty stream instead.Speed up
Base64.decode,Base64UrlandHexby using the nativeUint8ArrayBase64 and hex methods when the runtime provides them.Base64Url.encodeis also faster on runtimes without them.Keep a leading U+FEFF when decoding strings with
Base64,Base64Url,Hex, and theirSchema.StringFrom*codecs, includingHttpApiSecurity.basicusernames.Fix
Equal.equalsandHash.hashtreating otherwise identicalErrorvalues as different on Bun when they were constructed at different source locations.Fix
Workflow.intoResultrunning workflow finalizers before handler cleanup completes when interrupted immediately after startup.Fix
Headers.fromInputdropping earlier values for repeated header names in iterable input.Redact
HttpClientErrorrequest URLs with theUrlParams.CurrentRedactedNamesof the fiber that executed the request and of the fiber that created the error, as well as those of the fiber that renders it.Add a
messagetoHttpClientErrorSchemataken from its original reason, soRpcClientErrorHTTP failures no longer read as a bareHttpError:.HttpClient.withScopenow owns every request sent while the scoped client executes, instead of tracking the request value.Close a request scope transferred to a streamed body only after both the request and the body have finished, so middleware and tracing complete before request finalizers run.
Decode tool call parameters with their JSON codec, so a
Schema.Dateparameter accepts an ISO string from MCP clients and language models.Toolkit.WithHandler.handletakesSchema.Jsonparams. Direct callers pass the JSON encoding, withnullinstead ofundefinedfor optional parameters.With
disableToolCallResolution: true, tool callparamshold the JSON encoding and are typedSchema.Json. Provider-executed tools keep the provider's payload.Provider-defined tools keep their provider-defined type through
setSuccess,setFailure,setParameters,setNeedsApproval,addDependency,annotateandannotateMerge, so a tool the provider runs with a dependency is not mistaken for one that needs a handler.
Defer formatting the source location of
Atom.withLabelandAtom.serializablelabels until it is read.Skip undefined handlers in
Match.tagsandMatch.discriminators, and correct exhaustiveness checks for conditional handler maps, includingMatch.literals.Fix MCP
2026-07-28tools/callreturning a header mismatch for tools hidden byMcpServer.visibility, which revealed that they exist.Fix
McpServeraccepting cursors on core lists that never issue them, returningInvalidParamsinstead.Stop queued
McpServerprogress notifications after their request completes, is cancelled, or disconnects, while preserving background progress notifications.Fix
McpServer.resourceandMcpServer.registerResourceomitting the registeredmimeTypefromresources/readcontents when the handler returns a string orUint8Array. The type was only listed byresources/list, so MCP Apps hosts could not render UI resources served astext/html;profile=mcp-app.Trace
McpServerrequests with spans that follow the OpenTelemetry MCP semantic conventions.Spans are now named
{method} {target}(for exampletools/call get_weather) and carrymcp.*,jsonrpc.request.idandgen_ai.*attributes instead of the genericrpc.*ones. A W3Ctraceparentinparams._metacontinues the client's trace. Tool results withisError: trueseterror.typetotool_error, and JSON-RPC errors setrpc.status_code.Toolkit.handleno longer records tool arguments on the current span by default. It recordsgen_ai.tool.nameandgen_ai.tool.call.idinstead oftoolandparameters. ProvideToolkit.RecordToolArgumentsastrueto record arguments ingen_ai.tool.call.arguments.RpcServer.makeaccepts anonRequestoption that wraps the effect running each request's middleware and handler. The callback also receives the decoded request.Restrict the MCP Skills extension to protocol 2026-07-28.
McpServerno longer declares or serves it on earlier revisions, andMcpClientfails withUnsupportedErrorwhenextensions: { skills: true }is paired with an earlier protocol.Clients that use Skills must select
McpProtocol.v2026_07_28. On earlier revisions, read known skill files withreadResource.Build a fresh
RpcServer.Protocolfor everyMcpServer.layerStdiocall. Two stdio servers merged into one layer graph previously shared a single protocol, so only the first one read itsStdio.Fix
McpServer.layerStdiohanging after stdin EOF with an open subscription while preserving accepted finite responses.Reject ended transactions in MSSQL
call/withoutTransforms(), Bun SQLiteexportand libsqlreserve, and exposeSqlClient.activeTransactionConnectionfor custom drivers.Omit
contentSchemaannotations containing references inSchemaRepresentation.fromJsonSchemaDocumentandfromJsonSchemaMultiDocumentto avoid dangling references in generated schemas.Add
OpenRpc.fromRpcGrouptoeffect/rpc.Fix
OtlpMetricsexporting metrics without a declared unit as dimensionless ("1"); they now export an empty unit.Prometheus-compatible backends no longer append
_ratioto these gauge names (for example,app_build_info_ratiobecomesapp_build_info). Update affected queries and alerts, or setattributes: { unit: "1" }on the metric to keep the previous name.OtlpTracerandOtelTracernow leave the span status Unset instead of Ok when a span succeeds, or fails without a reportable error.OtelTracerno longer overwrites a status set directly on the span in those cases.Queries and dashboards that filter on Ok should also match Unset.
Add a
deduplicate: "untilExecuted"option toPersistedQueueoffer, which lets a custom id be offered again once its element completes or fails its final attempt.Fix
Queue.sliding(0)never waking waiting takers. Offers now hand the newest messages to waiting takers, and offers with no waiting taker are discarded instead of buffered.Fix zero-capacity bounded and dropping queues accepting offers without a new taker after
Queue.offerAll, which also affectedStream.buffer({ capacity: 0 }).Encode tool results with their JSON codec, so a
Schema.DateorSchema.BigIntin a tool result reaches language models, MCP clients andChat.exportJsonas JSON. Provider-executed tools keep the provider's payload.
Migration
- Breaking
A
Tool.dynamictool without asuccessschema must return a JSON value, even whentoModelOutputreplaces the model payload. Other values, such as aDate, now fail withToolResultEncodingError. Declare asuccessschema, for exampleSchema.Date, or return a JSON value. Declaresuccess: Schema.Voidfor a dynamic tool that returnsundefined. - Breaking
encodedResultof aSchema.Voidtool, includingTool.makewithout asuccessschema, is nownullinstead ofundefined. - Breaking
Fix
HttpStaticServerresponding200instead of304when anIf-None-Matchentity-tag contains a comma. - Breaking
Fix
Effect.race,Effect.raceFirst,Effect.raceAll,Effect.raceAllFirstandEffect.timeoutOptionsometimes letting a loser finish after the race settled, which could drop its result, such as an item taken from aQueue. - Breaking
Fix fail-mode fixed-window
RateLimiterchecks admitting more thanlimitrequests perwindowand reporting a shortenedresetAfter. - Breaking
Measure
RcMapidle time, includingRcMap.touch, on the clock of the context the map was made in, and run idle timers in that context instead of the last borrower's. - Breaking
Requests with the same fields and values now compare equal with
Equal.equalsregardless of the order their fields were provided in. - Breaking
Speed up type-checking of flat
RpcClientcalls andAtomRpcquery/mutationfor large RPC groups. Selecting an RPC by tag no longer tests every RPC in the group, which cuts instantiations about 5x and brings peak checker memory down to roughly the level of the object-shaped client.The flat client's
asQueue: trueresult now includesCause.Donein the dequeue error type, matching the object-shaped client and the runtime, which ends the queue withQueue.end.Adds the
Rpc.ByTag,RpcClient.RpcClient.Options,RpcClient.RpcClient.Result,AtomRpc.QueryandAtomRpc.Mutationutility types. - Breaking
Allow RPC handlers to fail with their server middleware's errors without repeating them in the RPC's
errorschema.Handlers returned by
RpcGroup.accessHandlercan now fail with those middleware errors. Handle them, or widen error types that previously allowed only the RPC's own errors.
- Breaking
Fix framed HTTP RPC batches hanging when requests rejected during dispatch produce more responses than
streamBufferSize. - Breaking
Fix
SchemaBinaryencoding non-number elements of a number array asNaNor0instead of failing with "Expected a number" when an earlier element needs 64-bit float encoding, such as"x"in[Math.PI, "x"]. - Breaking
Speed up
SchemaBinaryencoding of largeUint8Arraypayloads without changing the wire format.Uint8Arrayvalues of 16 KiB or more are now copied when the encode call returns, after the whole batch forencodeMany, so they must not change during the call. If such a value's length changes, for example because its buffer is detached, the encode fails with aSchemaError. Frames that contain these values are returned in their own buffer instead of a view into the shared output buffer. - Breaking
Prevent built-in prototype methods from being mistaken for user-supplied
Schema.Structfield values. For example,Schema.Struct({ toString: Schema.optionalKey(Schema.String) })now accepts{}instead of failing because the inheritedtoStringfunction is not a string.Declared fields whose names are owned by
Object.prototypenow require an own property, even on inputs with custom prototypes. This lets absent optional fields stay absent and decoding defaults run; missing required fields report a missing key. Other field names retain inherited-property support. - Breaking
Fix Schema encoding and decoding of schemas created by another copy of
effect, which could return an internal symbol instead of the input or reject a missing optional key; both copies must include this fix. - Breaking
Fix
Schema.toIsotyping nested class fields as class instances forSchema.TaggedUnionandSchema.brandschemas. - Breaking
Fix
isAnyOfonSchema.TaggedUnionandSchema.toTaggedUnionunions accepting keys that are not tags of the union, so misspelled tags and widestringarrays are now type errors.Bound generic key parameters by the union's tags, for example
<K extends Types.Tags<typeof Shape.Type>>or<K extends keyof typeof Shape.cases>, instead of<K extends string>.For a tag list only known at runtime, use a plain boolean predicate such as
(value: Shape): boolean => names.includes(value._tag). Filtering the list down to the union's tags makesisAnyOfcompile, but its false branch then excludes every tag in the filtered type, even if the list is empty at runtime.
- Breaking
Fix
Schema.toEquivalenceandSchema.toFormatterto derive consistently from the decoded type side, including records with transformed keys.Schema.toFormatter'sonBeforehook now receives type-side AST nodes without encoding transformations. Update hooks that depend on encoding metadata or original AST identities to use decoded AST nodes. UseSchema.overrideToFormatterto attach formatting to a specific schema. - Breaking
Stop
ScopedCacheentries whose lookup registers a finalizer from retaining the first requester's span and its response until the entry is removed. - Breaking
Interrupt pending
ScopedCache.getandScopedCache.getOptioncalls when their lookup completes after the cache's owner scope closes. - Breaking
Fix providing a generic
SqlClientlayer removing a driver service such asPgClientfrom an effect's requirements. The program type-checked as runnable but failed at runtime withService not found.A driver client is no longer a subtype of
SqlClient.SqlClient. Code that picks between driver layers, such ascond ? PgClient.layer(...) : MysqlClient.layer(...), may need an explicitLayer.Layer<SqlClient.SqlClient, E>annotation. - Breaking
Allow interrupting a nested
withTransactionwhile it waits for another nested transaction to release the savepoint. - Breaking
Skip savepoint release when an ancestor transaction ends during rollback, preserving the original failure without using the released connection.
- Breaking
Fail SQL statements and nested transactions from a fiber that outlives the transaction it was forked in, instead of running them on that transaction's connection.
- Breaking
Fix
SqlClient.withoutTransforms()keeping query name transforms when no result transform is configured, andStatement.makeignoring its compiler when called again with the same acquirer. - Breaking
Fix RPC and MCP stdio servers exiting with code 130 instead of 0 after stdin closes and pending responses drain.
- Breaking
Fix
OpenAiStructuredOutput.toCodecOpenAIandAnthropicStructuredOutput.toCodecAnthropicrejecting optional records and tuples in the format they advertise. - Breaking
Construct a
TestClockfaster and with less memory inTestClock.makeandTestClock.layer. - Breaking
Fix SQL-backed
PersistedQueuejobs retrying up to a second early on SQLite and MySQL, and remove an extra second of delay from delayed offers on SQLite. - Breaking
Fix effects hanging when
Scheduler.MaxOpsBeforeYieldis set to 1 or 2. - Breaking
Fix defects from a tool handler's interrupt finalizers being discarded when a
Toolkit.handlestream stops early. - Breaking
Fix
WorkflowEngine.layerMemoryrunningWorkflow.addFinalizerfinalizers before completion when a workflow is resumed after a defect or resumed concurrently. - Breaking
Add a
positionsoption toXml.decodeandXml.decodeStringthat reports thelineandcolumnof eachStartElement.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.