# recoverCorrelation
Source: https://docs.maelstrom-ai.co/dev/reference/engine/functions/recovercorrelation/
Documentation revision: 89a8f5e9d10cedcf0b30376d7846113f06f26120
SDK manifests in this build: @maelstrom-co/react@0.2.1, @maelstrom-co/client@0.2.1, @maelstrom-co/connectors@0.2.1, @maelstrom-co/protocol@0.2.1, @maelstrom-co/engine@0.2.1
These docs follow this source revision. Manifest versions do not prove release compatibility; verify the installed package exports before using an API.

> **recoverCorrelation**(`raw`): `object`

Defined in: [packages/engine/src/lib/envelope-handler.ts:32](https://github.com/maelstrom-co/maelstrom/blob/89a8f5e9d10cedcf0b30376d7846113f06f26120/packages/engine/src/lib/envelope-handler.ts#L32)

Best-effort correlation recovery for a frame that failed to decode.

A malformed frame has no typed envelope, but its raw JSON may still carry an `id` / `sessionId` the client is awaiting. Extracting them lets the host reject the pending promise instead of leaving the client to time out. Blank (empty or whitespace-only) strings are skipped since they correlate to nothing, and branding is defensively guarded so recovery can never throw. Returns `{}` when nothing could be recovered.

## Parameters

### raw

`unknown`

## Returns

`object`

### requestId?

> `optional` **requestId?**: `MessageId`

### sessionId?

> `optional` **sessionId?**: `SessionId`
