microsoft/playwright · error · Error

--data must be in "mime/type=value" format, got: ${entry}

Error message

--data must be in "mime/type=value" format, got: ${entry}

What it means

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.

Source

Thrown at packages/playwright-core/src/tools/cli-daemon/commands.ts:295

  name: 'drop',
  description: 'Drop files or data onto an element',
  category: 'core',
  args: z.object({
    target: z.string().describe(elementTargetDescription),
  }),
  options: z.object({
    path: stringArrayArg.optional().describe('Absolute path to a file to drop onto the element (repeatable)'),
    data: stringArrayArg.optional().describe('Data to drop in "mime/type=value" format, e.g. --data "text/plain=hello" (repeatable)'),
  }),
  toolName: 'browser_drop',
  toolParams: ({ target, path, data }) => {
    let dataMap: Record<string, string> | undefined;
    if (data) {
      dataMap = {};
      for (const entry of data) {
        const idx = entry.indexOf('=');
        if (idx === -1)
          throw new Error(`--data must be in "mime/type=value" format, got: ${entry}`);
        dataMap[entry.slice(0, idx)] = entry.slice(idx + 1);
      }
    }
    return { target, paths: path, data: dataMap };
  },
});

const fill = declareCommand({
  name: 'fill',
  description: 'Fill text into editable element',
  category: 'core',
  args: z.object({
    target: z.string().describe(elementTargetDescription),
    text: z.string().describe('Text to fill into the element'),
  }),
  options: z.object({
    submit: z.boolean().optional().describe('Whether to submit entered text (press Enter after)'),
  }),

View on GitHub (pinned to c8fc3bf8d3)

Solutions

  1. Re-issue the command with each `--data` entry formatted as `"mime/type=value"`, e.g. `--data "text/plain=hello"`.
  2. If dropping files, use `--path /abs/file` instead of `--data`.
  3. Note the parser splits on the FIRST `=` only, so values may themselves contain `=` (e.g. `--data "text/plain=a=b"` yields value `a=b`).

Example fix

// before
playwright-cli drop ref --data "hello"
// after
playwright-cli drop ref --data "text/plain=hello"
Defensive patterns

Strategy: validation

Validate before calling

// Validate each --data entry before passing to the daemon.
function formatDropData(entries: string[]): Record<string, string> {
  const map: Record<string, string> = {};
  for (const entry of entries) {
    const idx = entry.indexOf('=');
    if (idx === -1)
      throw new TypeError(`Bad --data entry (need "mime/type=value"): ${entry}`);
    map[entry.slice(0, idx)] = entry.slice(idx + 1);
  }
  return map;
}

Type guard

function isValidDataEntry(entry: string): boolean {
  return entry.includes('=');
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12). Data as JSON: /api/errors/357de8e6e096c65c. Report an issue: GitHub.