Bug Report: TypeError: Cannot read properties of undefined (reading 'length') at prompt assembly stage
To file: https://github.com/openclaw/openclaw/issues/new
Description
When @martian-engineering/lossless-claw v0.9.2 is enabled, all model calls fail at the prompt assembly stage with TypeError: Cannot read properties of undefined (reading 'length'). The error occurs before any provider API call is made — it's a crash in the core prompt builder triggered by an undefined field returned from lossless-claw's context assembly.
The same error hash (sha256:e980ad1b24fa) hits all models in the fallback chain, confirming it's not provider-specific.
Environment
- OpenClaw version: 2026.4.27 (built from go-ooa, commit 4eca5026e977)
- Node.js: 22.22.0
- OS: Linux 5.15.0-171-generic (x64)
- Lossless-claw version: 0.9.2 (installed via
openclaw plugins install @martian-engineering/lossless-claw)
- Lossless-claw enabled: yes
- Channels affected: Telegram, WhatsApp
Logs
[agent/embedded] embedded_run_failover_decision
stage: "prompt"
decision: "surface_error"
providerRuntimeFailureKind: "unclassified"
rawErrorPreview: "Cannot read properties of undefined (reading 'length')"
rawErrorHash: "sha256:e980ad1b24fa"
[diagnostic] lane task error:
lane=main
durationMs=6177
error="TypeError: Cannot read properties of undefined (reading 'length')"
Crash source: subsystem-Izr-DYZz.js (core prompt assembly subsystem, not lossless-claw code).
Pattern
Immediately before every crash, lossless-claw's [lcm] assemble-debug log completes successfully, then the core prompt builder crashes. This suggests lossless-claw's context engine is returning a message structure where a field expected to be an array is undefined.
Fallback chain (all fail identically)
| Attempt |
Provider |
Model |
Error |
| 1 |
Qwen (DashScope) |
deepseek-v4-flash |
❌ same error |
| 2 |
OpenRouter |
deepseek/deepseek-v4-flash |
❌ same error |
| 3 |
OpenRouter |
deepseek/deepseek-v4 |
❌ same error |
| 4 |
Anthropic |
claude-sonnet-4-6 |
❌ same error |
Workaround
openclaw doctor --fix (clears corrupt session state)
- Disable lossless-claw in config:
plugins.entries.lossless-claw.enabled = false
openclaw gateway restart
Related
Possible re-emergence of GitHub #66591 (reported fixed but may have regressed in 2026.4.27).
Bug Report:
TypeError: Cannot read properties of undefined (reading 'length')at prompt assembly stageTo file: https://github.com/openclaw/openclaw/issues/new
Description
When
@martian-engineering/lossless-clawv0.9.2 is enabled, all model calls fail at the prompt assembly stage withTypeError: Cannot read properties of undefined (reading 'length'). The error occurs before any provider API call is made — it's a crash in the core prompt builder triggered by an undefined field returned from lossless-claw's context assembly.The same error hash (
sha256:e980ad1b24fa) hits all models in the fallback chain, confirming it's not provider-specific.Environment
openclaw plugins install @martian-engineering/lossless-claw)Logs
Crash source:
subsystem-Izr-DYZz.js(core prompt assembly subsystem, not lossless-claw code).Pattern
Immediately before every crash, lossless-claw's
[lcm] assemble-debuglog completes successfully, then the core prompt builder crashes. This suggests lossless-claw's context engine is returning a message structure where a field expected to be an array isundefined.Fallback chain (all fail identically)
Workaround
openclaw doctor --fix(clears corrupt session state)plugins.entries.lossless-claw.enabled = falseopenclaw gateway restartRelated
Possible re-emergence of GitHub #66591 (reported fixed but may have regressed in 2026.4.27).