{"id":"82a47a6270f75944","repo":"jestjs/jest","slug":"messageparent-can-only-be-used-inside-a-worker","errorCode":null,"errorMessage":"\"messageParent\" can only be used inside a worker","messagePattern":"\"messageParent\" can only be used inside a worker","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/jest-worker/src/workers/messageParent.ts","lineNumber":47,"sourceCode":"    }\n  } else if (typeof parentProcess.send === 'function') {\n    try {\n      parentProcess.send([PARENT_MESSAGE_CUSTOM, message]);\n    } catch (error) {\n      if (\n        isError(error) &&\n        // if .send is a function, it's a serialization issue\n        !error.message.includes('.send is not a function')\n      ) {\n        // Apply specific serialization only in error cases\n        // to avoid affecting performance in regular cases.\n        parentProcess.send([PARENT_MESSAGE_CUSTOM, packMessage(message)]);\n      } else {\n        throw error;\n      }\n    }\n  } else {\n    throw new TypeError('\"messageParent\" can only be used inside a worker');\n  }\n}\n","sourceCodeStart":29,"sourceCodeEnd":50,"githubUrl":"https://github.com/jestjs/jest/blob/f49721c78e195558b40913977c9230f5b7f559d8/packages/jest-worker/src/workers/messageParent.ts#L29-L50","documentation":"Error \"\"messageParent\" can only be used inside a worker\" thrown in jestjs/jest.","triggerScenarios":"Thrown at packages/jest-worker/src/workers/messageParent.ts:47 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["messageParent can only be called from code running inside a jest-worker child process (a file passed as workerPath). Do not call it from the parent/main process; use it only inside the worker module."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"f49721c78e195558b40913977c9230f5b7f559d8","analyzedAt":"2026-08-03T20:16:28.571Z","schemaVersion":2}