Skip to content

Jinja crash after auto-compaction: System message must be at the beginning #11

Description

@ak1o-xxi

Description

After a long, tool-heavy session reaches the auto-compaction point, the session becomes permanently unusable with an HTTP 500 Jinja template error:

{
"error": {
"code": 500,
"message": "\n------------\nWhile executing CallExpression at line 150, column 32 in source:\n...first %}\n {- raise_exception(\n'System message must be at the beginnin...\n\nError: Jinja\nException: System message must be at the beginning.",
"type": "server_error"
}
}

This happens immediately after compaction. The next user message fails, and every subsequent message in the same session returns the same error. Restarting pentestcode fixes the session temporarily, but the issue returns after another long session reaches compaction.

Environment:

Local Ollama through OpenAI-compatible endpoint
Model: hf.co/Blackfrost-Research/M.O.G.-SEC-27B-1M-CTX-GGUF:Q3_K_L and any other Qwen3.8 27B models.

Plugins

No response

OpenCode version

pentestcode v0.2.5

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

Windows 11 AMD64Bit | WSL linux/x86-64

Terminal

Kali Linux terminal inside Docker(WSL)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions