{"record":{"id":"357de8e6e096c65c","repo":"microsoft/playwright","slug":"data-must-be-in-mime-type-value-format-got","errorCode":null,"errorMessage":"--data must be in \"mime/type=value\" format, got: ${entry}","messagePattern":"--data must be in \"mime/type=value\" format, got: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/tools/cli-daemon/commands.ts","lineNumber":295,"sourceCode":"  name: 'drop',\n  description: 'Drop files or data onto an element',\n  category: 'core',\n  args: z.object({\n    target: z.string().describe(elementTargetDescription),\n  }),\n  options: z.object({\n    path: stringArrayArg.optional().describe('Absolute path to a file to drop onto the element (repeatable)'),\n    data: stringArrayArg.optional().describe('Data to drop in \"mime/type=value\" format, e.g. --data \"text/plain=hello\" (repeatable)'),\n  }),\n  toolName: 'browser_drop',\n  toolParams: ({ target, path, data }) => {\n    let dataMap: Record<string, string> | undefined;\n    if (data) {\n      dataMap = {};\n      for (const entry of data) {\n        const idx = entry.indexOf('=');\n        if (idx === -1)\n          throw new Error(`--data must be in \"mime/type=value\" format, got: ${entry}`);\n        dataMap[entry.slice(0, idx)] = entry.slice(idx + 1);\n      }\n    }\n    return { target, paths: path, data: dataMap };\n  },\n});\n\nconst fill = declareCommand({\n  name: 'fill',\n  description: 'Fill text into editable element',\n  category: 'core',\n  args: z.object({\n    target: z.string().describe(elementTargetDescription),\n    text: z.string().describe('Text to fill into the element'),\n  }),\n  options: z.object({\n    submit: z.boolean().optional().describe('Whether to submit entered text (press Enter after)'),\n  }),","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/tools/cli-daemon/commands.ts#L277-L313","documentation":"Thrown by the CLI daemon's `drop` command parser when an `--data` entry contains no `=` separator. Each entry is split on the first `=` into a MIME-type key and a value, so an entry without `=` cannot be mapped and is rejected before the underlying `browser_drop` tool is invoked.","triggerScenarios":"Running the `drop` command with `--data \"plaintext\"` (no `=`), `--data \"text/plain\"` (mime type but no value delimiter), or any `--data` argument that omits the `=` character. `indexOf('=')` returning -1 is the exact condition.","commonSituations":"Forgetting the `=value` suffix; copy-pasting a file path into `--data` instead of `--path`; quoting a value that contains spaces but dropping the `mime/type=` prefix; shell splitting an entry that contained `=` inside an unquoted string.","solutions":["Re-issue the command with each `--data` entry formatted as `\"mime/type=value\"`, e.g. `--data \"text/plain=hello\"`.","If dropping files, use `--path /abs/file` instead of `--data`.","Note the parser splits on the FIRST `=` only, so values may themselves contain `=` (e.g. `--data \"text/plain=a=b\"` yields value `a=b`)."],"exampleFix":"// before\nplaywright-cli drop ref --data \"hello\"\n// after\nplaywright-cli drop ref --data \"text/plain=hello\"","handlingStrategy":"validation","validationCode":"// Validate each --data entry before passing to the daemon.\nfunction formatDropData(entries: string[]): Record<string, string> {\n  const map: Record<string, string> = {};\n  for (const entry of entries) {\n    const idx = entry.indexOf('=');\n    if (idx === -1)\n      throw new TypeError(`Bad --data entry (need \"mime/type=value\"): ${entry}`);\n    map[entry.slice(0, idx)] = entry.slice(idx + 1);\n  }\n  return map;\n}","typeGuard":"function isValidDataEntry(entry: string): boolean {\n  return entry.includes('=');\n}","tryCatchPattern":null,"preventionTips":["Always format --data as \"mime/type=value\"; values may contain '='.","Use --path for files, --data only for inline mime data.","Add a wrapper that validates entries client-side before sending to the daemon."],"tags":["cli","input-validation","daemon","drop"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}