(Created on )

Puppeteer: --user-data-dir is malformed

A raw --user-data-dir argument lacks the expected equals-sign value.


A raw —user-data-dir argument lacks the expected equals-sign value.

Error message

--user-data-dir is malformed

How this error happens

A raw --user-data-dir argument without an equals-sign value cannot be parsed as a Chrome profile path.

The snippets use the imported puppeteer instance.

await puppeteer.launch({
    args: [
        "--user-data-dir",
    ],
});

How to fix

Use Puppeteer’s userDataDir option instead of constructing the raw flag.

const browser = await puppeteer.launch({
    userDataDir: "/absolute/path/automation-profile",
});

Things to keep in mind

Use a writable automation profile, not your personal Chrome profile. Only one browser process should own that directory at a time.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →