On this page

InvalidRemoteFormResponseError

Trace a form response that fails SER's top-level envelope schema.

What this error means and what can trigger it

InvalidRemoteFormResponseError means the raw remote form response matches neither of the two top-level envelopes SER understands. An error envelope has type: "error" with optional error and status fields, whereas a result envelope has type: "result" with an optional devalue-encoded data or result string.

The raw response may be a primitive, null, an array, an object without a string type, an object with an unknown type, or an otherwise incompatible field shape. The class stores that value in envelope. SER also copies it into the surrounding transport failure's body.

That is slightly different from UnsupportedRemoteFormResponseError. Here, SER cannot even establish which top-level protocol branch it received.

Exactly where it triggers

const response = decode_form_response_envelope(envelope);

if (!response) {
	throw create_remote_transport_error(new InvalidRemoteFormResponseError(envelope), envelope);
}

At this point, the decoder uses Effect Schema to match the raw JSON against the error/result envelope union. The error is constructed only when that decoder returns no recognized branch. It is immediately nested inside RemoteTransportError, so client code normally inspects error.cause to reach it.

For reference, the class itself is declared at modules/svelte-effect-runtime/src/errors.ts L669 @ C14. This is its sole production construction site.

Why this is the case

SER must choose the error protocol or the result protocol before it can decode any inner value. Reading fields from an unvalidated object would allow malformed or version-skewed responses to drift into later branches and fail with misleading parser errors.

Preserving the raw envelope supports protocol diagnosis while maintaining the classification boundary. No status or domain meaning is invented, because the client has not successfully decoded the structure that would establish either one.