hi,
i had many bookmarks stored without tags or actually any ai enhancements, after some debugging journey it seems like a bug somewhere in openrouter or the ai provider returning successfully but with a bogus or empty response.
What happened:
some providers for gemma4:31b through openrouter returned successfully but only return either
{} (for provider DeepInfra)
{")} { ":") { "} (for provider ModelRun).
which resulted in the following log lines in grimoire for a request returning {} via Deepinfra (i've enabled request logging in openrouter, that's where i got the returned string from) and not a reprocessing.
{"ts":"2026-08-23T20:39:13.879Z","level":"info","msg":"Reprocess batch enqueued","ctx":{"batchId":"2d4afffd-c7db-4130-b2dc-4be2b4b25a92","mode":"selected","requested":1,"enqueued":1,"skipped":0}}
{"ts":"2026-08-23T20:39:13.998Z","level":"info","msg":"Pipeline: fetch","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64","url":"https://github.com/topoteretes/cognee"}}
{"ts":"2026-08-23T20:39:14.580Z","level":"info","msg":"Pipeline: fetch done","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64","finalUrl":"https://github.com/topoteretes/cognee"}}
{"ts":"2026-08-23T20:39:14.580Z","level":"info","msg":"Pipeline: extract","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64"}}
{"ts":"2026-08-23T20:39:14.580Z","level":"info","msg":"Using GitHub extractor","ctx":{"url":"https://github.com/topoteretes/cognee"}}
{"ts":"2026-08-23T20:39:16.195Z","level":"info","msg":"Pipeline: extract done","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64","wordCount":2583}}
{"ts":"2026-08-23T20:39:16.195Z","level":"info","msg":"Pipeline: ai_enrich","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64"}}
{"ts":"2026-08-23T20:39:17.161Z","level":"info","msg":"LLM enrichment parsed","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64","category":"Other","tagCount":0,"confidence":0.5}}
{"ts":"2026-08-23T20:39:17.166Z","level":"info","msg":"Pipeline: ai_enrich done","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64"}}
{"ts":"2026-08-23T20:39:17.166Z","level":"info","msg":"Pipeline: embed","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64"}}
{"ts":"2026-08-23T20:39:17.404Z","level":"info","msg":"Pipeline: embed done","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64","dimensions":1024}}
{"ts":"2026-08-23T20:39:17.404Z","level":"info","msg":"Pipeline: index","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64"}}
{"ts":"2026-08-23T20:39:17.408Z","level":"info","msg":"Pipeline: index done","ctx":{"bookmarkId":"fd69aa2d90ec7222ad9bce6b8260eb64"}}
{"ts":"2026-08-23T20:39:17.426Z","level":"info","msg":"Job completed","ctx":{"id":"4b72be78-3335-48ef-ab8a-86bd62e20257","type":"reprocess"}}
ps.: i extracted the system prompt and tried it in openrouter playground and it worked there without issues (that's how i found the problem to be provider specific, i've already reported that to openrouter and they ack'ed the problem, at least for DeepInfra).
what should have happened
i'm not sure it's a good idea to reject returned 200er responses , but eg. in such cases in our code we handle cases like that with something like when the response is clearly shorter than the required format and retry in that case. (eg. in case of grimoire like 20 chars?).
tl&rd: a reprocessing would have been nice.
as a help for others
for user with a similar issue i've added a script i've generated with google AI to reprocess all bookmarks with a configurable amount of minimum number of tags ;) (in my case everything with less than 3 tags was re-generated).
feel free to add or change as you wish.
grimoire.py
ps.: i've some problems where models running fine through openrouter do not work in grimoire with a lokal ollama, still debugging that.
hi,
i had many bookmarks stored without tags or actually any ai enhancements, after some debugging journey it seems like a bug somewhere in openrouter or the ai provider returning successfully but with a bogus or empty response.
What happened:
some providers for gemma4:31b through openrouter returned successfully but only return either
{}(for provider DeepInfra){")} { ":") { "}(for provider ModelRun).which resulted in the following log lines in grimoire for a request returning
{}via Deepinfra (i've enabled request logging in openrouter, that's where i got the returned string from) and not a reprocessing.ps.: i extracted the system prompt and tried it in openrouter playground and it worked there without issues (that's how i found the problem to be provider specific, i've already reported that to openrouter and they ack'ed the problem, at least for DeepInfra).
what should have happened
i'm not sure it's a good idea to reject returned 200er responses , but eg. in such cases in our code we handle cases like that with something like when the response is clearly shorter than the required format and retry in that case. (eg. in case of grimoire like 20 chars?).
tl&rd: a reprocessing would have been nice.
as a help for others
for user with a similar issue i've added a script i've generated with google AI to reprocess all bookmarks with a configurable amount of minimum number of tags ;) (in my case everything with less than 3 tags was re-generated).
feel free to add or change as you wish.
grimoire.py
ps.: i've some problems where models running fine through openrouter do not work in grimoire with a lokal ollama, still debugging that.