Skip to content

[Bug]: Ollama Web/cookie source reports No cookies available despite a valid session #426

Description

@agenciaingenium

Existing issues

What happened?

Description

Ollama (ollama.com) never shows real usage/pace data via the Web (cookie) source, even with a fully valid, currently-logged-in Brave session. The API-key source works but only returns a model-count placeholder ("N cloud models available", used_percent: 0.0), not real quota/Pace data — real usage requires the Web/cookie source per the README's provider matrix ("Ollama | Cookies / API Key | Usage, Cloud Models, Pace windows").

Verified independently of CodexBar (via curl, bypassing the app entirely) that the session is valid and the target page does contain real, parseable usage data server-rendered in the HTML:

  • GET https://ollama.com/settings with the browser's Cookie header → 200 OK, no sign-in redirect.
  • Page title: Usage · Settings.
  • Body contains exactly the markers the parser (rust/src/providers/ollama/mod.rs::parse_usage_block) looks for: e.g. 0% used, width: 61.2%, Resets in 20 hours, ISO timestamps like 2026-09-07T00:00:00.

So the account, session, and HTML parser all check out — but CodexBar's own cookie source resolution never gets that header to the parser.

Root cause (as far as I could narrow it down)

Running codexbar-cli.exe -v usage --provider ollama --source web:

DEBUG codexbar::browser::cookies: Searching for cookies for domain ollama.com
DEBUG codexbar::browser::cookies: Found 3 cookies for ollama.com in Brave

— it finds exactly the 3 cookies the browser has for ollama.com (__Secure-session, __stripe_mid, aid) — __Secure-session is in OLLAMA_SESSION_COOKIE_NAMES (rust/src/providers/ollama/cookies.rs), so it should be recognized. But the fetch still fails immediately after with:

Error: No cookies available for web API

That's the Display string for ProviderError::NoCookies (rust/src/core/provider.rs:577). Tracing the call path in resolve_browser_cookie_headerollama_cookie_header_for_urlcookie_applies_to_ollama_url, the only step between "3 raw cookies found" and "no recognized session cookie in the built header" is the per-cookie domain/path filter in cookie_applies_to_ollama_url. That strongly suggests the stored path (or domain) attribute on the real-world __Secure-session cookie doesn't satisfy that filter for the https://ollama.com/settings request URL, even though the cookie is valid and would obviously be sent by a real browser to that same URL.

Manually replaying the exact same 3-cookie header with curl against https://ollama.com/settings works perfectly (200, real usage data), which rules out the cookie/session itself and points at the filter in cookie_applies_to_ollama_url / ollama_cookie_header_for_url being stricter than an actual browser's cookie-matching rules.

Environment

  • CodexBar version: 0.55.0 (build 90), also present on current main
  • OS: Windows 11
  • Browser: Brave (cookie decryption itself works fine here — no App-Bound Encryption issue, unlike Chrome)
  • Provider: Ollama, Web/cookie source, valid logged-in session

Steps to reproduce

  1. Log into ollama.com in Brave.
  2. codexbar-cli.exe -v usage --provider ollama --source web → observe Found 3 cookies for ollama.com in Brave immediately followed by Error: No cookies available for web API.
  3. Copy the real Cookie header for ollama.com from DevTools → Network → any request to ollama.com/settings.
  4. curl -s -D - -o page.html "https://ollama.com/settings" -H "Cookie: <that header>"200 OK, page title Usage · Settings, body contains N% used, Resets in N hours, etc. — i.e., the exact data the parser wants, and the exact cookie CodexBar itself found for this domain.

Suggested fix direction

Loosen or re-check the per-cookie filter in cookie_applies_to_ollama_url (rust/src/providers/ollama/cookies.rs) — it looks like it's excluding a cookie a real browser would send. Might be worth logging the individual cookie name/path/domain triples (not just a count) at debug level so this class of mismatch is diagnosable without a manual curl replay.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions