tonhowtf/omniget · error
Unrecognized cookie format. Accepted: Netscape (yt-dlp)…
Error message
Unrecognized cookie format. Accepted: Netscape (yt-dlp), JSON (Edit-This-Cookie, Get-cookies.txt-LOCALLY), or Cookie header pairs like SESSDATA=...; bili_jct=... when a target domain is provided.
What it means
parse_for_domain() extends parse() by also accepting raw Cookie header pairs when a domain is supplied; if detect_format() returns Unknown and the content does not even look like a Cookie header, it bails with this format-specific message.
Solutions
- Provide only the cookie pairs: 'name=value; other=value' without the 'Cookie:' prefix or other headers.
- Export as Netscape (cookies.txt) or JSON array instead.
- Inspect detect_format()/looks_like_cookie_header logic if you believe the content is valid.
Example fix
// before
parse_for_domain("GET / HTTP/1.1\r\nCookie: a=b\r\nHost: x", "example.com")
// after
parse_for_domain("a=b", "example.com") Defensive patterns
Strategy: validation
Validate before calling
fn looks_like_header(c: &str) -> bool {
let t = c.trim().trim_start_matches("Cookie:");
t.split(';').all(|p| p.split_once('=').map_or(false, |(k, v)| !k.trim().is_empty() && !v.trim().is_empty())) && t.contains('=')
} Try / catch
match parsers::parse_for_domain(content, domain) {
Err(e) if e.to_string().contains("Unrecognized cookie format") => prompt_user_reexport(),
other => other,
} Prevention
- Pass only 'name=value; ...' pairs, not the full HTTP header block
- Prefer Netscape/JSON exports
- Trim whitespace and 'Cookie:' prefixes before import
When it happens
Trigger: Calling parse_for_domain with content that is neither Netscape, JSON, nor 'name=value; name2=value2' pairs — e.g. a full HTTP header block, HTML, or the string 'Cookie: a=b' with stray prefixes that defeat looks_like_cookie_header.
Common situations: Pasting the entire HTTP request headers instead of just the cookie pairs; copying cookies from a non-browser tool in a custom format; trailing whitespace/newlines mangling detection.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Unrecognized cookie format. Accepted: Netscape (yt-dlp)…
- Expected a JSON array of cookie objects.
- No valid cookies found in file (expected Netscape format)
- não achei appid para
- não achei nenhuma faixa em
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/1dee00a9f1a3860d.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/cookies/parsers.rs:61
pub fn parse(content: &str) -> anyhow::Result<Vec<ExtensionCookie>> {
match detect_format(content) {
CookieFormat::Netscape => parse_netscape(content),
CookieFormat::Json => parse_json(content),
CookieFormat::Unknown => {
anyhow::bail!("Unrecognized cookie format. Accepted: Netscape (yt-dlp), JSON (Edit-This-Cookie, Get-cookies.txt-LOCALLY), or a Cookie header when a target domain is provided.")
}
}
}
pub fn parse_for_domain(content: &str, domain: &str) -> anyhow::Result<Vec<ExtensionCookie>> {
match detect_format(content) {
CookieFormat::Netscape => parse_netscape(content),
CookieFormat::Json => parse_json(content),
CookieFormat::Unknown if looks_like_cookie_header(content) => {
parse_cookie_header(content, domain)
}
CookieFormat::Unknown => {
anyhow::bail!("Unrecognized cookie format. Accepted: Netscape (yt-dlp), JSON (Edit-This-Cookie, Get-cookies.txt-LOCALLY), or Cookie header pairs like SESSDATA=...; bili_jct=... when a target domain is provided.")
}
}
}
fn looks_like_cookie_header(content: &str) -> bool {
let trimmed = content.trim();
if trimmed.is_empty() || trimmed.contains('\t') || trimmed.starts_with('#') {
return false;
}
let body = trimmed.strip_prefix("Cookie:").unwrap_or(trimmed).trim();
let mut found = 0usize;
for part in body.split(';') {
let p = part.trim();
if p.is_empty() {
continue;
}
let Some((name, value)) = p.split_once('=') else {
return false;View on GitHub (pinned to 8600b91f42)