openclaw - ✅(Solved) Fix [Bug]: `TypeError: Cannot read properties of undefined (reading 'startsWith') in subsystem file after v2026.4.15 update [2 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#68013Fetched 2026-04-18 05:54:26
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2labeled ×2referenced ×2

Title: `TypeError: Cannot read properties of undefined (reading 'startsWith') in subsystem file after v2026.4.15 update

Body:

Error Message

TypeError: Cannot read properties of undefined (reading 'startsWith') at subsystem-Cgmckbux.js:316

Root Cause

Title: `TypeError: Cannot read properties of undefined (reading 'startsWith') in subsystem file after v2026.4.15 update

Body:

Fix Action

Fixed

PR fix notes

PR #68029: fix(logging): add optional chaining for subsystem.startsWith to prevent crash

Description (problem / solution / changelog)

Fixes #68013

Problem: Cron jobs crash with TypeError: Cannot read properties of undefined (reading 'startsWith') in src/logging/subsystem.ts. The ternary expression extracting runId/sessionId from params.meta can return undefined, and .startsWith('probe-') is called on it without optional chaining.

Fix: Added optional chaining (?.) before .startsWith('probe-') so the expression safely returns undefined instead of throwing.

Tests: Added test cases covering params.meta being undefined and the probe detection path.

Changed files

  • src/logging/subsystem.test.ts (modified, +24/-1)
  • src/logging/subsystem.ts (modified, +4/-3)

PR #68080: fix(logging): null-guard params.subsystem.startsWith in shouldSuppressProbeConsoleLine

Description (problem / solution / changelog)

Summary

In shouldSuppressProbeConsoleLine(), params.subsystem.startsWith() was called without a null guard. When params.subsystem is undefined or null, .startsWith() throws a TypeError, crashing cron jobs and any agent that logs probe-session events.

Changes

src/logging/subsystem.ts — add ?. optional chaining to two startsWith() calls:

// Before:
params.subsystem.startsWith("agent/embedded/")
params.subsystem.startsWith("model-fallback/")

// After:
params.subsystem?.startsWith("agent/embedded/")
params.subsystem?.startsWith("model-fallback/")

Behavior Contract

ScenarioBeforeAfter
subsystem = undefinedTypeError crashfalse
subsystem = nullTypeError crashfalse
subsystem = "model-fallback/primary"truetrue
subsystem = "agent/embedded/main"truetrue

Closes

Closes #68013


Author: WadeY [email protected]

Changed files

  • src/agents/run-wait.ts (modified, +44/-0)
  • src/agents/tools/sessions-send-tool.ts (modified, +29/-0)
  • src/logging/subsystem.ts (modified, +2/-2)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Title: `TypeError: Cannot read properties of undefined (reading 'startsWith') in subsystem file after v2026.4.15 update

Body:

Bug Description

Cron jobs fail with TypeError: Cannot read properties of undefined (reading 'startsWith') after updating to v2026.4.15.

Error

TypeError: Cannot read properties of undefined (reading 'startsWith') at subsystem-Cgmckbux.js:316

Affected Code

File: dist/subsystem-Cgmckbux.js, line 316

javascript // Buggy: if ((typeof params.meta?.runId === "string" ? params.meta.runId : typeof params.meta?.sessionId === "string" ? params.meta.sessionId : void 0)?.startsWith("probe-")) return true;

// Fix: if ((typeof params.meta?.runId === "string" ? params.meta.runId : typeof params.meta?.sessionId === "string" ? params.meta.sessionId : void 0)?.startsWith("probe-") ?? false) return true;

Impact

All cron jobs that trigger this code path fail. Affects Jamie, Hunter, and other agents running scheduled tasks.

Environment

  • OpenClaw v2026.4.15

  • Node.js (gateway mode)

Steps to reproduce

Steps to reproduce:

  1. Have an OpenClaw cron job that triggers a non-probe agent session (e.g. Jamie Market Update)
  2. Wait for the cron job to fire, OR restart the gateway after an update
  3. Observe: TypeError: Cannot read properties of undefined (reading 'startsWith') in the gateway log

Expected behavior

Expected behavior: The probe-session check should gracefully return false when runId and sessionId are both undefined, without throwing.

Actual behavior

Actual behavior: TypeError: Cannot read properties of undefined (reading 'startsWith') at subsystem-Cgmckbux.js:316 — the optional chaining ?.startsWith() doesn't guard the case where the ternary chain returns void 0. Adding ?? false fixes it.

OpenClaw version

2026.4.15

Operating system

Lubuntu 24.04

Install method

Npm

Model

Minimax 2.7

Provider / routing chain

Openclaw -> minimax

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The most likely fix is to update the conditional statement in subsystem-Cgmckbux.js to handle the case where params.meta.runId and params.meta.sessionId are both undefined.

Guidance

  • Review the code change provided in the "Affected Code" section, which adds a nullish coalescing operator (?? false) to the conditional statement to handle the case where the ternary chain returns void 0.
  • Verify that the fix works by running a cron job that triggers a non-probe agent session and checking the gateway log for the TypeError.
  • Consider updating the code to use a more explicit null check, such as if (params.meta.runId || params.meta.sessionId) { ... }, to improve readability and maintainability.
  • Test the fix in a non-production environment before deploying it to production to ensure that it does not introduce any new issues.

Example

// Fixed:
if ((typeof params.meta?.runId === "string" ? params.meta.runId : typeof params.meta?.sessionId === "string" ? params.meta.sessionId : void 0)?.startsWith("probe-") ?? false) return true;

Notes

The provided fix assumes that the intention of the code is to return false when both runId and sessionId are undefined. If this is not the case, additional changes may be necessary.

Recommendation

Apply the workaround by updating the conditional statement in subsystem-Cgmckbux.js to include the nullish coalescing operator (?? false), as this fix has been verified to resolve the TypeError issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected behavior: The probe-session check should gracefully return false when runId and sessionId are both undefined, without throwing.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: `TypeError: Cannot read properties of undefined (reading 'startsWith') in subsystem file after v2026.4.15 update [2 pull requests, 1 participants]