Transport answered, but the Effect RPC protocol did not — typically something else is listening
on the address (wrong process / wrong protocol). Surfaced by
Hyperlink.verifyConnection(node, { deep: true }) after the cheap reachability probe
succeeds.
export class class ProtocolUnansweredclass ProtocolUnanswered {
message: string;
name: string;
stack: string;
cause: unknown;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
_tag: Tag;
node: string;
url: string;
kind: ProtocolKind;
}
Transport answered, but the Effect RPC protocol did not — typically something else is listening
on the address (wrong process / wrong protocol). Surfaced by
Hyperlink.verifyConnection
(node, { deep: true }) after the cheap reachability probe
succeeds.
ProtocolUnanswered extends import DataData.const TaggedError: <"ProtocolUnanswered">(tag: "ProtocolUnanswered") => new <A>(args: VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
readonly _tag: "ProtocolUnanswered";
} & Readonly<A>
Creates a tagged error class with a _tag discriminator.
When to use
Use when you need domain errors with discriminated-union handling.
Details
Like
Error
, but instances also carry a readonly _tag property,
enabling Effect.catchTag and Effect.catchTags for tag-based recovery.
The _tag is excluded from the constructor argument. Yielding an instance
inside Effect.gen fails the effect with this error.
Example (Recovering by tag)
import { Data, Effect } from "effect"
class NotFound extends Data.TaggedError("NotFound")<{
readonly resource: string
}> {}
class Forbidden extends Data.TaggedError("Forbidden")<{
readonly reason: string
}> {}
const program = Effect.gen(function*() {
return yield* new NotFound({ resource: "/users/42" })
})
const recovered = program.pipe(
Effect.catchTag("NotFound", (e) =>
Effect.succeed(`missing: ${e.resource}`))
)
TaggedError("ProtocolUnanswered")<{
readonly node: stringnode: string;
readonly url: stringurl: string;
readonly kind: ProtocolKindkind: type ProtocolKind =
| "Http"
| "WebSocket"
| "IpcSocket"
The transport a
Node
speaks — tag-style names (apps rarely type this alias; they write
the literals or get inference from url / path):
"Http" — RpcClient.layerProtocolHttp (servers / CLIs)
"WebSocket" — browser WS (layerProtocolWebsocket / client layerProtocolSocket over WS)
"IpcSocket" — Unix-domain socket (same-machine; see
ipcServer
)
Stamped on the node so the topology is self-describing about how to reach it — connect/client
derive the transport from it. Inferred from a ws(s):// url, an http target, or { path } →
IpcSocket; otherwise declare it explicitly.
ProtocolKind;
readonly cause: unknowncause: unknown;
}> {
override get ProtocolUnanswered.message: stringmessage() {
return (
`Node "${this.node: stringnode}" is reachable at ${this.url: stringurl} but did not answer the RPC protocol ` +
`(${this.kind: ProtocolKindkind}) — is something else listening there?`
);
}
}