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 a Cookie header when a target domain is provided.
What it means
The cookie parser's parse() dispatches on detect_format(); when the content is neither Netscape nor JSON it is Unknown, and parse() (which has no domain parameter, so Cookie headers can't be scoped) bails with this message listing the accepted formats.
Solutions
- Export cookies as Netscape format (yt-dlp cookies.txt) or JSON array (Edit-This-Cookie).
- If you only have a Cookie header, call parse_for_domain(content, domain) instead of parse().
- Trim stray 'Cookie:' prefixes/quotes and re-export if detection still fails.
Example fix
// before
let cookies = parsers::parse("SESSDATA=abc; bili_jct=xyz")?;
// after
let cookies = parsers::parse_for_domain("SESSDATA=abc; bili_jct=xyz", "bilibili.com")?; Defensive patterns
Strategy: validation
Validate before calling
fn is_supported_cookie_format(c: &str) -> bool {
let t = c.trim();
t.starts_with('#') || t.starts_with('[') || t.starts_with('{') // Netscape / JSON
} Try / catch
match parsers::parse(content) {
Ok(cookies) => cookies,
Err(e) if e.to_string().contains("Unrecognized cookie format") => {
parsers::parse_for_domain(content, target_domain)?
}
Err(e) => return Err(e),
} Prevention
- Use yt-dlp-style cookies.txt or extension JSON exports
- If you only have a header, always call parse_for_domain
- Strip 'Cookie:' prefixes before importing
When it happens
Trigger: Calling parse() with a raw Cookie header string like 'SESSDATA=...; bili_jct=...', HTML, or other non-Netscape/non-JSON content.
Common situations: User pastes a browser DevTools 'Cookie:' request header instead of a cookies.txt export; empty/garbage clipboard content; extension export in an unsupported shape.
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/a8a7dcdfd1a31a34.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/cookies/parsers.rs:48
let first = trimmed.chars().next().unwrap_or(' ');
if first == '[' || first == '{' {
return CookieFormat::Json;
}
if trimmed.starts_with("# Netscape")
|| trimmed.starts_with("#HttpOnly_")
|| trimmed.contains('\t')
{
return CookieFormat::Netscape;
}
CookieFormat::Unknown
}
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 {View on GitHub (pinned to 8600b91f42)