openclaw - 💡(How to fix) Fix Foundry plugin enters infinite reload loop, crashes gateway [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#58046Fetched 2026-04-08 01:54:35
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

The foundry-openclaw plugin enters an infinite reload loop that crashes the OpenClaw gateway. The plugin re-registers itself multiple times per second (up to 1,448 reload cycles in a single day), eventually exhausting memory and killing the process without a clean exit log.

Error Message

  • Last confirmed Telegram delivery failed at 19:36: Delivery failed (telegram to telegram:2112108642): Error: Unable to resolve plugin runtime module

Root Cause

The foundry-openclaw plugin enters an infinite reload loop that crashes the OpenClaw gateway. The plugin re-registers itself multiple times per second (up to 1,448 reload cycles in a single day), eventually exhausting memory and killing the process without a clean exit log.

Fix Action

Workaround

Removing foundry-openclaw from plugins.allow and plugins.load.paths in openclaw.json resolves the issue. Gateway runs stable without foundry.

Code Example

2026-03-30T19:45:00.669 [INFO] [foundry] Plugin registered (23 tools, ...)
2026-03-30T19:45:01.102 [INFO] [foundry] Plugin registered (23 tools, ...)
2026-03-30T19:45:01.544 [INFO] [foundry] Plugin registered (23 tools, ...)
2026-03-30T19:45:02.184 [INFO] [foundry] Plugin registered (23 tools, ...)
RAW_BUFFERClick to expand / collapse

Description

The foundry-openclaw plugin enters an infinite reload loop that crashes the OpenClaw gateway. The plugin re-registers itself multiple times per second (up to 1,448 reload cycles in a single day), eventually exhausting memory and killing the process without a clean exit log.

Environment

  • OpenClaw: 2026.3.24
  • OS: Windows 10 Pro 10.0.19045
  • Node: 24.11.1
  • Plugin: @getfoundry/foundry-openclaw (installed from C:\Users\Dan\.openclaw\extensions\foundry)

Reproduction

  1. Enable foundry-openclaw in openclaw.json plugins.allow and plugins.load.paths
  2. Start the gateway
  3. Observe foundry plugin registering repeatedly (~0.4s intervals):
2026-03-30T19:45:00.669 [INFO] [foundry] Plugin registered (23 tools, ...)
2026-03-30T19:45:01.102 [INFO] [foundry] Plugin registered (23 tools, ...)
2026-03-30T19:45:01.544 [INFO] [foundry] Plugin registered (23 tools, ...)
2026-03-30T19:45:02.184 [INFO] [foundry] Plugin registered (23 tools, ...)
  1. Gateway dies within minutes with no exit/crash log entry (silent OOM)

Log Evidence

  • 1,448 foundry plugin registrations in a single day before final crash
  • Each cycle re-registers all plugins (foundry, memory-lancedb, lcm)
  • Pattern counts grew from 94 → 126 → cleared → rebuilt across restarts
  • Final log entry was a token drift warning, then silence — no graceful shutdown
  • Last confirmed Telegram delivery failed at 19:36: Delivery failed (telegram to telegram:2112108642): Error: Unable to resolve plugin runtime module

Timeline (2026-03-30)

  • Gateway running throughout day with foundry enabled
  • 19:44 — Discord WebSocket disconnected (code 1005, max reconnect attempts reached)
  • 19:44-19:46 — Foundry reload storm intensifies (~4 registrations/second)
  • 19:46:40 — Last log entry, gateway dies silently
  • Restarted at 21:30 — same crash loop immediately resumed (69 registrations in 2 min), died at 21:32

Workaround

Removing foundry-openclaw from plugins.allow and plugins.load.paths in openclaw.json resolves the issue. Gateway runs stable without foundry.

Additional Context

Before the crash, a Janet session had been working on improving foundry patterns (pruning 107 dead-weight patterns, writing manual high-quality patterns, attempting crystallization). The reload storm may have been triggered by foundry's self-modification / pattern-write operations causing a recursive reload cycle.

extent analysis

Fix Plan

To resolve the infinite reload loop issue with the foundry-openclaw plugin, we need to prevent the plugin from re-registering itself multiple times per second. Here are the steps to fix the issue:

  • Step 1: Update the plugin to prevent recursive reloads We need to modify the foundry-openclaw plugin to prevent it from re-registering itself when it detects changes to its own patterns. We can do this by adding a flag to track whether the plugin is already registered.
// foundry-openclaw plugin code
let isRegistered = false;

// ...

if (!isRegistered) {
  // Register the plugin
  isRegistered = true;
}
  • Step 2: Debounce plugin registrations To prevent the plugin from re-registering itself too quickly, we can add a debounce function to delay registrations for a short period of time.
// foundry-openclaw plugin code
const debounceTimeout = 100; // 1 second
let registrationTimeout = null;

// ...

if (!isRegistered) {
  if (registrationTimeout) {
    clearTimeout(registrationTimeout);
  }
  registrationTimeout = setTimeout(() => {
    // Register the plugin
    isRegistered = true;
  }, debounceTimeout);
}
  • Step 3: Review and optimize pattern modification code We should review the code that modifies the foundry patterns to ensure it is not causing the recursive reload cycle. We can optimize the code to reduce the number of times the plugin needs to re-register itself.

Verification

To verify that the fix worked, we can:

  • Enable the foundry-openclaw plugin in openclaw.json and start the gateway
  • Observe the plugin registration logs to ensure the plugin is not re-registering itself multiple times per second
  • Test the plugin's functionality to ensure it is working as expected

Extra Tips

To prevent similar issues in the future, we should:

  • Monitor the plugin registration logs to detect any issues with the plugin
  • Review and optimize the plugin code regularly to prevent recursive reload cycles
  • Consider adding additional logging or monitoring to detect issues with the plugin before they cause a crash.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING