Gangmax Blog

single-file-cli: "Invalid parameters when calling Network.setCookies"

When using “single-file-cli” with a “cookies.json” file, I got the following error:

1
2
> ./single-file-aarch64-apple-darwin --browser-cookies-file="./cookies.json" https://... target.html
Invalid parameters when calling Network.setCookies({"cookies":[{ ... }]})

The cookie JSON file was exported by a chrome extension which contained the following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[
{
"domain": ".xyz.com",
"expirationDate": 1756787525.533015,
"hostOnly": false,
"httpOnly": true,
"name": "_esc_h38",
"path": "/",
"sameSite": null
"secure": true,
"session": false,
"storeId": null,
"value": "5nNCJOP4Ss"
},
...
]

ChatGPT said only the “name/value/domain/path” fields were required which seemed correct. The “sameSite/storeId” fields seemed suspect because of the “null” value. I removed these two fields and tried. The error didn’t show anymore. Not sure why the “Cookie-Editor” extension exports invalid field values but good to know the solution with the help from ChatGPT.

Comments