openclaw - 💡(How to fix) Fix [Feature]: Build pipeline should validate bundled channel entry specifiers exist in dist output [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#61710Fetched 2026-04-08 02:55:32
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Error Message

  1. Fails the build with a clear error if any specifier doesn't resolve to an existing file
  • #61708 — misleading error message when runtime detection fails

Root Cause

This means source-only paths (e.g., ./src/channel.js) can be committed and pass CI, only to crash the gateway at runtime on every user's machine because the file doesn't exist in the build output.

RAW_BUFFERClick to expand / collapse

Problem

The build pipeline (scripts/tsdown-build.mjs) does not verify that every specifier declared in a defineBundledChannelEntry() call resolves to a file that actually exists in the emitted dist/extensions/<id>/ directory.

This means source-only paths (e.g., ./src/channel.js) can be committed and pass CI, only to crash the gateway at runtime on every user's machine because the file doesn't exist in the build output.

Concrete case

Commit 4aeabf95cc changed the Mattermost extension's specifier to ./src/channel.js. This path is valid in the development source tree but is never emitted to dist/extensions/mattermost/ by the build. The build completed with exit code 0. The crash only manifested at runtime when listChannelSecretTargetRegistryEntries() tried to open the file (see #61681, #61682, #61708).

Proposed fix

After the build emits dist/, add a validation step in tsdown-build.mjs (or as a post-build hook) that:

  1. Iterates all dist/extensions/<id>/index.js files
  2. Extracts the specifier values from defineBundledChannelEntry() calls (or reads a manifest)
  3. Resolves each specifier relative to dist/extensions/<id>/
  4. Fails the build with a clear error if any specifier doesn't resolve to an existing file

This would have caught the Mattermost regression at build time rather than runtime, preventing the issue from shipping in a release.

Related

  • #61681, #61682 — runtime crash caused by this missing validation
  • #61708 — misleading error message when runtime detection fails

extent analysis

TL;DR

Add a validation step to the build pipeline to verify that every specifier declared in a defineBundledChannelEntry() call resolves to an existing file in the dist/extensions/<id>/ directory.

Guidance

  • Identify the defineBundledChannelEntry() calls in the build pipeline and extract the specifier values.
  • Implement a post-build hook in tsdown-build.mjs to iterate over the dist/extensions/<id>/index.js files and resolve each specifier relative to its directory.
  • Check if each resolved specifier corresponds to an existing file and fail the build with a clear error message if any specifier is invalid.
  • Consider reading a manifest file to simplify the extraction of specifier values.

Example

// Example validation step in tsdown-build.mjs
const fs = require('fs');
const path = require('path');

// Iterate over dist/extensions/<id>/index.js files
fs.readdirSync('dist/extensions').forEach((id) => {
  const indexFile = `dist/extensions/${id}/index.js`;
  const specifiers = extractSpecifiersFromIndexFile(indexFile);
  specifiers.forEach((specifier) => {
    const resolvedPath = path.resolve(`dist/extensions/${id}`, specifier);
    if (!fs.existsSync(resolvedPath)) {
      throw new Error(`Invalid specifier: ${specifier} does not exist in ${id} directory`);
    }
  });
});

Notes

This solution assumes that the defineBundledChannelEntry() calls are made in the index.js files within the dist/extensions/<id> directories. The implementation of the extractSpecifiersFromIndexFile() function is not provided and should be adapted to the specific use case.

Recommendation

Apply the proposed fix by adding a validation step to the build pipeline to ensure that all specifier values resolve to existing files. This will prevent similar runtime crashes and regressions from shipping in future releases.

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

openclaw - 💡(How to fix) Fix [Feature]: Build pipeline should validate bundled channel entry specifiers exist in dist output [1 participants]