[GH-ISSUE #214] [Issue]: Long-Term Memory extraction fails with llama.cpp grammar sampler error #106

Closed
opened 2026-10-20 17:24:27 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Aug 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/214

Originally assigned to: @Promansis on GitHub.

Summary

Long-Term Memory extraction fails against local llama.cpp OpenAI-compatible endpoints when the endpoint converts the requested JSON schema into a grammar that exceeds llama.cpp's repetition safety limits. The package reports the provider's HTTP 400 instead of retrying without structured output.

Affected package

long-term-memory (current package version 1.1.0; fix target 1.1.2)

Expected behavior

Extraction should complete against llama.cpp OpenAI-compatible endpoints. If the endpoint cannot compile the generated structured-output grammar, Long-Term Memory should retry the extraction without response_format, then parse and validate the returned JSON using its existing server-side parser.

Actual behavior

Extraction fails with:

Custom OpenAIcompatible endpoint error 400: Failed to initialize samplers: failed to parse grammar

The llama.cpp server logs:

parse: error parsing grammar: number of rules that are going to be repeated multiplied by the new repetition exceeds sane defaults, please reduce the number of repetitions or rule complexity

The existing fallback recognizes unsupported schema/response-format errors, but this error only mentions sampler and grammar parsing, so the fallback is not triggered.

Steps to reproduce

  1. Configure Marinara Engine with a local llama.cpp server through a custom OpenAI-compatible endpoint.
  2. Use the Long-Term Memory agent and start extraction for a source note.
  3. Observe the HTTP 400 from the custom endpoint and the llama.cpp grammar parse error in the server log.

Environment

  • Marinara Engine version: Not provided
  • Package version: 1.1.0
  • Install type: Not provided
  • OS + version: Not provided
  • Browser or app shell: Not provided
  • Model server: llama.cpp OpenAI-compatible server

Logs, screenshots, or video

Custom OpenAIcompatible endpoint error 400: Failed to initialize samplers: failed to parse grammar

parse: error parsing grammar: number of rules that are going to be repeated multiplied by the new repetition exceeds sane defaults, please reduce the number of repetitions or rule complexity

Additional context

The likely fix is to classify llama.cpp grammar initialization/parse failures as structured-output incompatibility in the existing extraction fallback, rather than weakening the extraction schema limits. Bump the Long-Term Memory package to 1.1.2 and rebuild the generated artifact and catalog entries.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Aug 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Agents/issues/214 Originally assigned to: @Promansis on GitHub. ## Summary Long-Term Memory extraction fails against local llama.cpp OpenAI-compatible endpoints when the endpoint converts the requested JSON schema into a grammar that exceeds llama.cpp's repetition safety limits. The package reports the provider's HTTP 400 instead of retrying without structured output. ## Affected package `long-term-memory` (current package version `1.1.0`; fix target `1.1.2`) ## Expected behavior Extraction should complete against llama.cpp OpenAI-compatible endpoints. If the endpoint cannot compile the generated structured-output grammar, Long-Term Memory should retry the extraction without `response_format`, then parse and validate the returned JSON using its existing server-side parser. ## Actual behavior Extraction fails with: ```text Custom OpenAIcompatible endpoint error 400: Failed to initialize samplers: failed to parse grammar ``` The llama.cpp server logs: ```text parse: error parsing grammar: number of rules that are going to be repeated multiplied by the new repetition exceeds sane defaults, please reduce the number of repetitions or rule complexity ``` The existing fallback recognizes unsupported schema/response-format errors, but this error only mentions sampler and grammar parsing, so the fallback is not triggered. ## Steps to reproduce 1. Configure Marinara Engine with a local llama.cpp server through a custom OpenAI-compatible endpoint. 2. Use the Long-Term Memory agent and start extraction for a source note. 3. Observe the HTTP 400 from the custom endpoint and the llama.cpp grammar parse error in the server log. ## Environment - Marinara Engine version: Not provided - Package version: `1.1.0` - Install type: Not provided - OS + version: Not provided - Browser or app shell: Not provided - Model server: llama.cpp OpenAI-compatible server ## Logs, screenshots, or video ```text Custom OpenAIcompatible endpoint error 400: Failed to initialize samplers: failed to parse grammar parse: error parsing grammar: number of rules that are going to be repeated multiplied by the new repetition exceeds sane defaults, please reduce the number of repetitions or rule complexity ``` ## Additional context The likely fix is to classify llama.cpp grammar initialization/parse failures as structured-output incompatibility in the existing extraction fallback, rather than weakening the extraction schema limits. Bump the Long-Term Memory package to `1.1.2` and rebuild the generated artifact and catalog entries. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:24:27 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#106
No description provided.