openclaw - ✅(Solved) Fix [Bug]: subagent cleanup finalize failed: Cannot find module subagent-registry.runtime.js (v2026.4.12) [1 pull requests, 1 comments, 2 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#66151Fetched 2026-04-14 05:39:02
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
cross-referenced ×2labeled ×2commented ×1referenced ×1

After a subagent completes, the parent session fails to auto-resume with: [warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from subagent-registry-CflSFWBm.js

The file subagent-registry.runtime.js is missing from dist. subagent-registry-CflSFWBm.js imports it but it doesn't exist on disk. Impact: Subagents complete successfully; only the post-run cleanup/session-resume step fails. Version: OpenClaw 2026.4.12 (1c0672b), Linux arm64, node v22.22.2

Error Message

[warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from subagent-registry-CflSFWBm.js ends without error [warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from subagent-registry-CflSFWBm.js

Root Cause

After a subagent completes, the parent session fails to auto-resume with: [warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from subagent-registry-CflSFWBm.js

The file subagent-registry.runtime.js is missing from dist. subagent-registry-CflSFWBm.js imports it but it doesn't exist on disk. Impact: Subagents complete successfully; only the post-run cleanup/session-resume step fails. Version: OpenClaw 2026.4.12 (1c0672b), Linux arm64, node v22.22.2

Fix Action

Fixed

PR fix notes

PR #66265: fix(build): add subagent-registry.runtime to stable dist entries

Description (problem / solution / changelog)

Summary

  • Adds subagent-registry.runtime as a named entry in buildCoreDistEntries() so the bundler emits dist/subagent-registry.runtime.js
  • Without this entry, the opaque URL construction in importRuntimeModule (via new URL(parts.join(""), import.meta.url)) cannot be statically traced, so the file was never emitted as a chunk

Root Cause

Commit 74f31241ed refactored subagent-registry.ts to use importRuntimeModule instead of a direct string-literal dynamic import. The bundler can't trace new URL(parts.join(""), baseUrl).href, so subagent-registry.runtime.ts stopped being emitted to dist. At runtime, subagent cleanup calls loadContextEngineInitModule() which tries to import the missing file and crashes.

Fix

One-line addition to tsdown.config.ts, following the existing pattern described in the comment at lines 144-145: "Keep long-lived lazy runtime boundaries on stable filenames so rebuilt dist/ trees do not strand already-running gateways on stale hashed chunks."

Verification

  • pnpm build succeeds
  • dist/subagent-registry.runtime.js is produced (318 bytes)
  • No INEFFECTIVE_DYNAMIC_IMPORT warnings

Closes #66151

Changed files

  • tsdown.config.ts (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After a subagent completes, the parent session fails to auto-resume with: [warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from subagent-registry-CflSFWBm.js

The file subagent-registry.runtime.js is missing from dist. subagent-registry-CflSFWBm.js imports it but it doesn't exist on disk. Impact: Subagents complete successfully; only the post-run cleanup/session-resume step fails. Version: OpenClaw 2026.4.12 (1c0672b), Linux arm64, node v22.22.2

Steps to reproduce

subagent spawn > session crash

Expected behavior

ends without error

Actual behavior

[warn] subagent cleanup finalize failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/usr/lib/node_modules/openclaw/dist/subagent-registry.runtime.js' imported from subagent-registry-CflSFWBm.js

OpenClaw version

OpenClaw 2026.4.12 (1c0672b)

Operating system

Debian GNU/Linux 13 (trixie)

Install method

npm global

Model

openrouter/claude/sonnet-4.6

Provider / routing chain

openclaw-openrouter

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 ensure the subagent-registry.runtime.js file is correctly included in the dist directory, possibly by verifying the build process or adjusting the import path in subagent-registry-CflSFWBm.js.

Guidance

  • Verify the build process of OpenClaw to ensure that subagent-registry.runtime.js is being correctly compiled and included in the dist directory.
  • Check the import path in subagent-registry-CflSFWBm.js to confirm it matches the actual location of subagent-registry.runtime.js on disk.
  • Consider checking for any recent changes in the OpenClaw version (2026.4.12) that might affect the build or packaging of the subagent-registry.runtime.js file.
  • If using a global npm installation, try reinstalling OpenClaw to ensure all dependencies are correctly installed and up-to-date.

Example

No specific code example is provided due to the lack of detailed code context in the issue.

Notes

The issue seems to be related to a missing file in the dist directory, which could be due to a build or packaging error. Without more information about the build process or recent changes to OpenClaw, it's challenging to provide a more specific solution.

Recommendation

Apply a workaround by manually verifying the build process and adjusting the import path if necessary, as the issue does not seem to be directly related to a version-specific bug that could be fixed by upgrading.

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

ends without error

Still need to ship something?

×6

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

Back to top recommendations

TRENDING