{"record":{"id":"31fb1a0dcf785a5f","repo":"remotion-dev/remotion","slug":"response-errormessage","errorCode":null,"errorMessage":"$response->errorMessage","messagePattern":"\\$response->errorMessage","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"packages/lambda-php/src/PHPClient.php","lineNumber":318,"sourceCode":"            'InvocationType' => 'RequestResponse',\n            'FunctionName' => $this->getFunctionName(),\n            'Payload' => $payload,\n        ]);\n\n        if ($result['StatusCode'] !== 200) {\n            throw new Exception(\"Failed to invoke Lambda function\");\n        }\n\n        return $result['Payload']->getContents();\n    }\n\n    private function handleLambdaResponseRender(string $response): RenderMediaOnLambdaResponse\n    {\n        $response = json_decode($response, true);\n\n        // AWS response\n        if (isset($response->errorMessage)) {\n            throw new Exception($response->errorMessage);\n        }\n\n        $classResponse = new RenderMediaOnLambdaResponse();\n\n        // Remotion response\n        if ($response['type'] === 'error') {\n            throw new Exception($response['message']);\n        }\n\n        $classResponse->type = $response['type'];\n        $classResponse->renderId = $response['renderId'];\n        $classResponse->bucketName = $response['bucketName'];\n\n        return $classResponse;\n    }\n\n    private function handleLambdaResponseProgress(string $response): GetRenderProgressResponse\n    {","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-php/src/PHPClient.php#L300-L336","documentation":"Thrown by handleLambdaResponseRender when the decoded Lambda response is detected as an AWS error envelope and its errorMessage is re-thrown. NOTE: there is a latent bug — json_decode is called with `true` (associative array), so `$response` is an array, but the code uses object syntax `$response->errorMessage`. With an associative array, `isset($response->errorMessage)` is false, so this branch effectively never fires for a normal array-shaped error envelope; the dynamic message is whatever the Lambda function returned as errorMessage.","triggerScenarios":"The Lambda function returns a payload shaped like `{\"errorMessage\":\"...\",\"errorType\":\"...\",\"stackTrace\":[...]}` (the AWS error envelope for an unhandled exception). To trigger this exact branch the value would need to be decoded as an object, which only happens if json_decode's second arg is removed.","commonSituations":"The deployed Remotion function threw an unhandled exception (out-of-memory, runtime crash, bad input that escaped the typed error path). When the branch does fire, the message reflects the function's exception message verbatim.","solutions":["Log the raw response payload to capture the full error envelope (errorType + stackTrace), not just errorMessage.","Reproduce locally against the same serve URL and composition to find the runtime cause.","Align the PHP client version with the deployed Remotion Lambda function version.","If you maintain this client, fix the decode-mode bug so the envelope is read consistently (see exampleFix)."],"exampleFix":"// before\n$response = json_decode($response, true);\nif (isset($response->errorMessage)) { // never true for assoc array\n    throw new Exception($response->errorMessage);\n}\n\n// after - decode as object (or use array syntax consistently)\n$response = json_decode($response);\nif (isset($response->errorMessage)) {\n    throw new Exception($response->errorMessage);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Until the decode-mode bug is fixed, guard defensively.\n$body = json_decode($raw, true);\nif (is_array($body) && isset($body['errorMessage'])) {\n    throw new RuntimeException('Lambda error envelope: ' . $body['errorMessage']);\n}\nif (is_object($body) && isset($body->errorMessage)) {\n    throw new RuntimeException('Lambda error envelope: ' . $body->errorMessage);\n}","preventionTips":["Log the raw Lambda payload to capture errorType and stackTrace, not just errorMessage.","Keep the PHP client version aligned with the deployed Remotion function version.","If you maintain this client, fix json_decode's second argument (or use array syntax) so the envelope check works."],"tags":["lambda","response-handling","bug","error-envelope","php","lambda-php"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}