RangeError: Maximum call stack size exceeded when loading extension models with npm dependencies after upgrade to 20260317
Opened by swampadmin · 10/27/2025
Description
After upgrading swamp from 20260315.010849.0 to 20260317.010646.0, extension models that import npm packages beyond npm:zod@4 fail to load with RangeError: Maximum call stack size exceeded.
Steps to Reproduce
- Have extension models in
extensions/models/that import npm packages (e.g.npm:@octokit/rest@22.0.1,npm:@slack/web-api@7.14.1,npm:bonjour-service@1.3.0,jsr:@bradenmacdonald/s3-lite-client@0.7) - Run
swamp repo upgradeto upgrade to20260317.010646.0 - Run any swamp command (e.g.
swamp model type search --json)
Observed Behavior
Every command produces warnings like:
Warning: Failed to load user model github_helpers.ts: RangeError: Maximum call stack size exceeded
Warning: Failed to load user model github_issue.ts: RangeError: Maximum call stack size exceeded
Warning: Failed to load user model slack.ts: RangeError: Maximum call stack size exceeded
Warning: Failed to load user model s3.ts: RangeError: Maximum call stack size exceeded
Warning: Failed to load user model homekit.ts: RangeError: Maximum call stack size exceeded
Warning: Failed to load user model tailnet_healthcheck.ts: RangeError: Maximum call stack size exceededModels that only import npm:zod@4 (e.g. kubevirt_vm.ts, honeycomb.ts, opentelemetry.ts) continue to load successfully.
The npm packages load fine in standalone Deno (deno eval 'import { Octokit } from "npm:@octokit/rest@22.0.1"; console.log("ok")' works).
Expected Behavior
All extension models should load successfully as they did on 20260315.010849.0.
Environment
- swamp version:
20260317.010646.0(previously worked on20260315.010849.0) - Deno: 2.7.5
- Platform: macOS Darwin 25.3.0 (aarch64)
Summary
This is a regression in the model loader introduced in the 20260317 release. The stack overflow occurs during module loading, not during execution, suggesting the loader's dependency resolution or module wrapping has a recursive path that blows the stack when npm packages with deep dependency trees are involved. The fix would likely be in the extension model loading/compilation pipeline — possibly the module wrapper or import resolver that was changed in this release.
Closed
No activity in this phase yet.
Sign in to post a ripple.