decolua/9router · error · Error

installed pxpipe package does not export transformAnthropicM

Error message

installed pxpipe package does not export transformAnthropicMessages

What it means

Thrown by doLoad when the installed pxpipe package was successfully imported via dynamic import but does not export a `transformAnthropicMessages` function. The loader validates the module's API surface immediately after import and refuses to cache/use a module that doesn't implement the expected transform contract, protecting the request pipeline from calling an undefined function.

Source

Thrown at src/lib/pxpipe/loader.js:31

export async function loadPxpipe() {
  if (cached) return cached;
  if (loadPromise) return loadPromise;
  loadPromise = doLoad().finally(() => { loadPromise = null; });
  return loadPromise;
}

async function doLoad() {
  const info = getInstallInfo();
  if (!info.installed) {
    const err = new Error("PXPIPE is not installed");
    err.code = "NOT_INSTALLED";
    throw err;
  }
  // Cache-bust per version so Repair/upgrade takes effect without a server restart.
  const url = `${pathToFileURL(libraryEntry()).href}?v=${encodeURIComponent(info.version || "0")}`;
  const mod = await import(/* webpackIgnore: true */ url);
  if (typeof mod.transformAnthropicMessages !== "function") {
    throw new Error("installed pxpipe package does not export transformAnthropicMessages");
  }
  cached = { module: mod, version: info.version, loadedAt: Date.now() };
  return cached;
}

export function unloadPxpipe() {
  const wasLoaded = !!cached;
  cached = null;
  return wasLoaded;
}

// Transform function for the request pipeline; null when unavailable (fail-open).
// autoLoad controls whether a cold cache triggers a load (first request warms it).
export async function getTransform({ autoLoad = true } = {}) {
  try {
    if (!cached && !autoLoad) return null;
    const { module: mod } = await loadPxpipe();
    return mod.transformAnthropicMessages;

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Check the installed package's entry (libraryEntry()) and confirm transformAnthropicMessages is a named export in its package.json main/exports target.
  2. Reinstall/upgrade pxpipe to the version this app expects (use the Repair action, which bumps the ?v= cache-bust and reloads), then restart the pipeline load.
  3. Pin a known-good pxpipe version instead of @latest so upstream renames can't break the contract.
  4. If you control both sides, re-add/rename the export: module.exports.transformAnthropicMessages = transform... (or export function transformAnthropicMessages).
  5. Clear PXPIPE_DIR and reinstall cleanly to rule out a corrupted/partial install resolving to the wrong entry.

Example fix

// before (pxpipe package entry)
export { transformAnthropicMessages as transform };
// after: keep the contract export name
export function transformAnthropicMessages({ body, model }) { /* ... */ }
Defensive patterns

Strategy: type-guard

Validate before calling

const mod = await import(pathToFileURL(libraryEntry()).href);
if (typeof mod.transformAnthropicMessages !== "function") {
  throw new Error("installed pxpipe package does not export transformAnthropicMessages");
}

Type guard

function exportsTransform(mod) {
  return !!mod && typeof mod.transformAnthropicMessages === "function";
}

Try / catch

try {
  const { module: mod } = await loadPxpipe();
  if (!exportsTransform(mod)) throw new Error("incompatible pxpipe build");
} catch (e) {
  if (e.message.includes("does not export transformAnthropicMessages")) {
    await repairPxpipe(); // reinstall matching version, bump cache-bust
  } else throw e;
}

Prevention

When it happens

Trigger: A different or older/newer version of the pxpipe package is installed whose entry point no longer exports transformAnthropicMessages; a stale/renamed export upstream; the cache-busting URL (?v=<version>) resolved to a wrong file; a corrupted install where the entry resolved to an unexpected module.

Common situations: Upgrading pxpipe and the library got out of sync (package renamed the export); an old cached install predating the current API; npm installed a placeholder/renamed package with the same name; semver drift between the app expecting the export and the @latest package fetched during install.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/2cf36d4483317572. Report an issue: GitHub.