You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Bug]: "Message ID alias capacity exceeded" persists in v3.1.12 — regression of #452, session permanently unusable past 9999 messages
Bug Description
After ~10,000 messages in a single long-running opencode session, every new user message is rejected with the error originally reported in #452:
Message ID alias capacity exceeded. Cannot allocate more than m9999 aliases in this session.
Issue #452 was closed as COMPLETED on 2026-03-25 after the fix shipped in v3.0.5, but the same user (jiwangyihao) immediately commented that the issue still reproduces in v3.1.0 with a continuously-working session. There was no follow-up reply on that thread.
I'm now hitting it in DCP v3.1.12 with the same symptom. My affected session has exactly 10,028 messages in the message table at ~/.local/share/opencode/opencode.db (range 2026-05-01 → 2026-05-24, ~3 weeks of continuous work). The session itself is otherwise healthy on disk — the cap is enforced purely by the DCP plugin at chat-time.
Root cause (verified locally):
The alias allocator at node_modules/@tarquinen/opencode-dcp/dist/index.js lines 1833–1945 (in the bundled output) hard-codes:
allocateNextMessageRef() walks state.messageIds.byRef, and once 9999 aliases are taken it throws. There is no environment variable, config flag, or runtime knob to widen the range. The previous fix in v3.0.5 evidently did not address the underlying constraint — it likely only addressed alias re-use across compactions, not the hard 4-digit ceiling.
Impact: Once a session crosses 9,999 messages, it becomes permanently unwriteable as long as DCP is loaded. The only workaround is to disable the DCP plugin (opencode.json) and restart, at which point the session works fine again — confirming the underlying opencode session is intact and the constraint is purely in DCP.
Expected Behavior
Either:
Widen the alias space to 5+ digits (e.g. MESSAGE_REF_WIDTH = 5 → m00001..m99999), or
Make the width configurable in dcp.jsonc (e.g. messageRefs.maxIndex or messageRefs.width), or
Recycle/garbage-collect aliases once their underlying message has been folded into a compressed block and is no longer referenced.
At minimum, the error should suggest the workaround (disable DCP for that session) rather than just throwing.
Debug Context Logs
Note: "debug": true was not previously enabled on this machine, so no logs were captured at the moment of failure. The bug, however, is deterministic and easily reproducible — any session that crosses 9,999 messages with DCP loaded will hit it. The constraint is in the source code, not in any conditional/race-condition path. I'm happy to attach logs from a reproducer session on request, but I'd rather not generate another 10k-message session just to capture them.
{
"note": "Reproducer is deterministic: any DCP-enabled session that allocates a 10000th alias hits the cap. See referenced source location for the throw site."
}
Tool Call Details
The failure is not triggered by a specific tool call — it occurs on every subsequent user message after the alias pool is exhausted. The stack trace from #452 still applies (paths shifted slightly between versions):
at allocateNextMessageRef (.../node_modules/@tarquinen/opencode-dcp/dist/index.js [bundled])
at assignMessageRefs (...)
at <hook handler invoked at session load / per message>
DCP Version
3.1.12
Opencode Version
1.15.5 (also reproduces on 1.15.6 — same DB-backed session storage; the constraint is independent of opencode version)
Model
Other (specify in description)
I've reproduced with anthropic/claude-sonnet-4-6 (Sonnet 4.6, 1M context) and anthropic/claude-opus-4-7 (Opus 4.7, 1M context). The model is irrelevant — the throw happens in the DCP plugin's pre-chat hook before any model is invoked.
Proposed minimum fix: bump MESSAGE_REF_WIDTH to 5 (m00001..m99999) — gives 10× headroom with one-character TUI cost; no schema change required.
Proposed proper fix: make the width configurable in the schema, default it to 5, log a one-line warning at startup when a session crosses 50% of the configured ceiling.
Thanks for the great plugin — it's been very useful right up until the wall.
[Bug]: "Message ID alias capacity exceeded" persists in v3.1.12 — regression of #452, session permanently unusable past 9999 messages
Bug Description
After ~10,000 messages in a single long-running opencode session, every new user message is rejected with the error originally reported in #452:
Issue #452 was closed as
COMPLETEDon 2026-03-25 after the fix shipped in v3.0.5, but the same user (jiwangyihao) immediately commented that the issue still reproduces in v3.1.0 with a continuously-working session. There was no follow-up reply on that thread.I'm now hitting it in DCP v3.1.12 with the same symptom. My affected session has exactly 10,028 messages in the
messagetable at~/.local/share/opencode/opencode.db(range 2026-05-01 → 2026-05-24, ~3 weeks of continuous work). The session itself is otherwise healthy on disk — the cap is enforced purely by the DCP plugin at chat-time.Root cause (verified locally):
The alias allocator at
node_modules/@tarquinen/opencode-dcp/dist/index.jslines 1833–1945 (in the bundled output) hard-codes:allocateNextMessageRef()walksstate.messageIds.byRef, and once 9999 aliases are taken it throws. There is no environment variable, config flag, or runtime knob to widen the range. The previous fix in v3.0.5 evidently did not address the underlying constraint — it likely only addressed alias re-use across compactions, not the hard 4-digit ceiling.Impact: Once a session crosses 9,999 messages, it becomes permanently unwriteable as long as DCP is loaded. The only workaround is to disable the DCP plugin (
opencode.json) and restart, at which point the session works fine again — confirming the underlying opencode session is intact and the constraint is purely in DCP.Expected Behavior
Either:
MESSAGE_REF_WIDTH = 5→m00001..m99999), ordcp.jsonc(e.g.messageRefs.maxIndexormessageRefs.width), orAt minimum, the error should suggest the workaround (disable DCP for that session) rather than just throwing.
Debug Context Logs
{ "note": "Reproducer is deterministic: any DCP-enabled session that allocates a 10000th alias hits the cap. See referenced source location for the throw site." }Tool Call Details
The failure is not triggered by a specific tool call — it occurs on every subsequent user message after the alias pool is exhausted. The stack trace from #452 still applies (paths shifted slightly between versions):
DCP Version
3.1.12
Opencode Version
1.15.5 (also reproduces on 1.15.6 — same DB-backed session storage; the constraint is independent of opencode version)
Model
Other (specify in description)
I've reproduced with
anthropic/claude-sonnet-4-6(Sonnet 4.6, 1M context) andanthropic/claude-opus-4-7(Opus 4.7, 1M context). The model is irrelevant — the throw happens in the DCP plugin's pre-chat hook before any model is invoked.Additional Context
dcp.jsoncconfig used:{ "$schema": "https://raw.githubusercontent.com/Opencode-DCP/opencode-dynamic-context-pruning/master/dcp.schema.json", "compress": { "protectUserMessages": true }, "turnProtection": { "enabled": true } }MESSAGE_REF_WIDTHto 5 (m00001..m99999) — gives 10× headroom with one-character TUI cost; no schema change required.Thanks for the great plugin — it's been very useful right up until the wall.