{"record":{"id":"143326efc93a253b","repo":"microsoft/playwright","slug":"unexpected-data-type","errorCode":null,"errorMessage":"Unexpected 'data' type","messagePattern":"Unexpected 'data' type","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/client/fetch.ts","lineNumber":212,"sourceCode":"      // Cannot call allHeaders() here as the request may be paused inside route handler.\n      const headersObj = options.headers || options.request?.headers();\n      const headers = headersObj ? headersObjectToArray(headersObj) : undefined;\n      let jsonData: any;\n      let formData: channels.NameValue[] | undefined;\n      let multipartData: channels.FormField[] | undefined;\n      let postDataBuffer: Buffer | undefined;\n      if (options.data !== undefined) {\n        if (isString(options.data)) {\n          if (isJsonContentType(headers))\n            jsonData = isJsonParsable(options.data) ? options.data : JSON.stringify(options.data);\n          else\n            postDataBuffer = Buffer.from(options.data, 'utf8');\n        } else if (Buffer.isBuffer(options.data)) {\n          postDataBuffer = options.data;\n        } else if (typeof options.data === 'object' || typeof options.data === 'number' || typeof options.data === 'boolean') {\n          jsonData = JSON.stringify(options.data);\n        } else {\n          throw new Error(`Unexpected 'data' type`);\n        }\n      } else if (options.form) {\n        if (globalThis.FormData && options.form instanceof FormData) {\n          formData = [];\n          for (const [name, value] of options.form.entries()) {\n            if (typeof value !== 'string')\n              throw new Error(`Expected string for options.form[\"${name}\"], found File. Please use options.multipart instead.`);\n            formData.push({ name, value });\n          }\n        } else {\n          formData = objectToArray(options.form);\n        }\n      } else if (options.multipart) {\n        multipartData = [];\n        if (globalThis.FormData && options.multipart instanceof FormData) {\n          const form = options.multipart;\n          for (const [name, value] of form.entries()) {\n            if (isString(value)) {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/client/fetch.ts#L194-L230","documentation":"Error \"Unexpected 'data' type\" thrown in microsoft/playwright.","triggerScenarios":"Thrown at packages/playwright-core/src/client/fetch.ts:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}