pbakaus/impeccable · critical · Error

Live browser script part missing: ${part.name} (${part.path}

Error message

Live browser script part missing: ${part.name} (${part.path})

What it means

Thrown by assertLiveBrowserScriptParts() when one of the three canonical browser script files (session-state, dom-helpers, browser-ui -> live-browser-session.js, live-browser-dom.js, live-browser.js) is missing from scriptsDir. resolveLiveBrowserScriptParts() joins scriptsDir with each part.file; assertLiveBrowserScriptParts() then checks fs.existsSync on each path. The assemble step cannot proceed without all three because the browser bundle is built by concatenating their sources.

Source

Thrown at plugin/skills/impeccable/scripts/live/browser-script-parts.mjs:24

export const LIVE_BROWSER_SCRIPT_PARTS = Object.freeze([
  Object.freeze({ name: 'session-state', file: 'live-browser-session.js' }),
  Object.freeze({ name: 'dom-helpers', file: 'live-browser-dom.js' }),
  Object.freeze({ name: 'browser-ui', file: 'live-browser.js' }),
]);

export function resolveLiveBrowserScriptParts(scriptsDir, parts = LIVE_BROWSER_SCRIPT_PARTS) {
  if (!scriptsDir) throw new Error('scriptsDir is required');
  return parts.map((part, index) => ({
    ...part,
    index,
    path: path.join(scriptsDir, part.file),
  }));
}

export function assertLiveBrowserScriptParts(parts, exists = fs.existsSync) {
  for (const part of parts) {
    if (!exists(part.path)) {
      throw new Error(`Live browser script part missing: ${part.name} (${part.path})`);
    }
  }
  return parts;
}

export function readLiveBrowserScriptParts(parts, readFile = (filePath) => fs.readFileSync(filePath, 'utf-8')) {
  return parts.map((part) => ({
    ...part,
    source: readFile(part.path),
  }));
}

export function assembleLiveBrowserScript({
  token,
  port,
  vocabulary,
  commandPrefix = '/',
  appRoot = null,

View on GitHub (pinned to d14711ae3d)

Solutions

  1. Ensure scriptsDir contains live-browser-session.js, live-browser-dom.js, and live-browser.js (the LIVE_BROWSER_SCRIPT_PARTS list).
  2. Reinstall or re-clone the skill so the scripts directory is complete.
  3. If running from source, run the build (`bun run build`) to regenerate any missing browser scripts.
  4. Point the caller at the correct scripts directory — the assembled bundle uses `path.join(scriptsDir, part.file)`.

Example fix

// before
const parts = resolveLiveBrowserScriptParts(wrongDir);
assertLiveBrowserScriptParts(parts);

// after
const scriptsDir = path.join(__dirname, 'scripts'); // the dir holding live-browser*.js
const parts = resolveLiveBrowserScriptParts(scriptsDir);
assertLiveBrowserScriptParts(parts);
Defensive patterns

Strategy: validation

Validate before calling

import { resolveLiveBrowserScriptParts, assertLiveBrowserScriptParts } from './live/browser-script-parts.mjs';
import fs from 'node:fs';
const parts = resolveLiveBrowserScriptParts(scriptsDir);
const missing = parts.filter((p) => !fs.existsSync(p.path));
if (missing.length) {
  throw new Error('Browser script dir incomplete; reinstall the skill. Missing: ' + missing.map((m) => m.file).join(', '));
}
assertLiveBrowserScriptParts(parts);

Try / catch

try {
  assertLiveBrowserScriptParts(parts);
} catch (err) {
  if (/Live browser script part missing/.test(err.message)) {
    // reinstall the skill or rebuild browser scripts (bun run build:browser)
    console.error(err.message, '— reinstall the impeccable skill.');
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: scriptsDir pointed at the wrong directory (e.g. plugin path vs source path mismatch); a script file was deleted/moved during a refactor; running against a partial install where the browser script set wasn't copied; tests passed a custom scriptsDir missing one file. The check is injected with an `exists` function for testability, but in production it's fs.existsSync.

Common situations: Skill installed via a path that doesn't include the browser scripts (partial npm/git checkout); build step that copies scripts but skipped *.js; version mismatch where LIVE_BROWSER_SCRIPT_PARTS added a new file not present in older installs; running from a source tree after `git clean` removed generated files.

Related errors


AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13). Data as JSON: /api/errors/85929ef594eae690. Report an issue: GitHub.