{"record":{"id":"1dee00a9f1a3860d","repo":"tonhowtf/omniget","slug":"unrecognized-cookie-format-accepted-netscape-yt-dlp-json-1dee00","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/cookies/parsers.rs","lineNumber":61,"sourceCode":"pub fn parse(content: &str) -> anyhow::Result<Vec<ExtensionCookie>> {\n    match detect_format(content) {\n        CookieFormat::Netscape => parse_netscape(content),\n        CookieFormat::Json => parse_json(content),\n        CookieFormat::Unknown => {\n            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.\")\n        }\n    }\n}\n\npub fn parse_for_domain(content: &str, domain: &str) -> anyhow::Result<Vec<ExtensionCookie>> {\n    match detect_format(content) {\n        CookieFormat::Netscape => parse_netscape(content),\n        CookieFormat::Json => parse_json(content),\n        CookieFormat::Unknown if looks_like_cookie_header(content) => {\n            parse_cookie_header(content, domain)\n        }\n        CookieFormat::Unknown => {\n            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.\")\n        }\n    }\n}\n\nfn looks_like_cookie_header(content: &str) -> bool {\n    let trimmed = content.trim();\n    if trimmed.is_empty() || trimmed.contains('\\t') || trimmed.starts_with('#') {\n        return false;\n    }\n    let body = trimmed.strip_prefix(\"Cookie:\").unwrap_or(trimmed).trim();\n    let mut found = 0usize;\n    for part in body.split(';') {\n        let p = part.trim();\n        if p.is_empty() {\n            continue;\n        }\n        let Some((name, value)) = p.split_once('=') else {\n            return false;","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/cookies/parsers.rs#L43-L79","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nparse_for_domain(\"GET / HTTP/1.1\\r\\nCookie: a=b\\r\\nHost: x\", \"example.com\")\n// after\nparse_for_domain(\"a=b\", \"example.com\")","handlingStrategy":"validation","validationCode":"fn looks_like_header(c: &str) -> bool {\n    let t = c.trim().trim_start_matches(\"Cookie:\");\n    t.split(';').all(|p| p.split_once('=').map_or(false, |(k, v)| !k.trim().is_empty() && !v.trim().is_empty())) && t.contains('=')\n}","typeGuard":null,"tryCatchPattern":"match parsers::parse_for_domain(content, domain) {\n    Err(e) if e.to_string().contains(\"Unrecognized cookie format\") => prompt_user_reexport(),\n    other => other,\n}","preventionTips":["Pass only 'name=value; ...' pairs, not the full HTTP header block","Prefer Netscape/JSON exports","Trim whitespace and 'Cookie:' prefixes before import"],"tags":["cookies","parsing","format","header"],"backgroundTag":"invalid-argument-format","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}