thedotmack/claude-mem · error · Error

Codex marketplace root ${resolved} is missing required files

Error message

Codex marketplace root ${resolved} is missing required files: ${missing.join(', ')}

What it means

assertCodexMarketplaceRoot() validates that a candidate directory contains every entry in REQUIRED_MARKETPLACE_FILES (.agents/plugins/marketplace.json, plugin/.codex-plugin/plugin.json, plugin/.mcp.json, plugin/hooks/codex-hooks.json, plugin/skills/mem-search/SKILL.md). When an explicit preferredRoot is supplied and any file is missing, it throws listing the gaps rather than registering a half-built marketplace with Codex.

Source

Thrown at src/services/integrations/CodexCliInstaller.ts:65

  while (true) {
    if (existsSync(path.join(current, '.agents', 'plugins', 'marketplace.json'))) {
      return current;
    }
    const parent = path.dirname(current);
    if (parent === current) return null;
    current = parent;
  }
}

function missingMarketplaceFiles(root: string): string[] {
  return REQUIRED_MARKETPLACE_FILES.filter((entry) => !existsSync(path.join(root, entry)));
}

function assertCodexMarketplaceRoot(root: string): string {
  const resolved = path.resolve(root);
  const missing = missingMarketplaceFiles(resolved);
  if (missing.length > 0) {
    throw new Error(`Codex marketplace root ${resolved} is missing required files: ${missing.join(', ')}`);
  }
  return resolved;
}

function resolvePluginMarketplaceRoot(preferredRoot?: string): string {
  if (preferredRoot) {
    return assertCodexMarketplaceRoot(preferredRoot);
  }

  const candidates = [
    process.env.CLAUDE_PLUGIN_ROOT,
    process.env.PLUGIN_ROOT,
    process.cwd(),
    path.dirname(fileURLToPath(import.meta.url)),
  ].filter((value): value is string => Boolean(value));

  for (const candidate of candidates) {
    const resolved = findAncestorWithCodexMarketplace(candidate);

View on GitHub (pinned to d768ba3643)

Solutions

  1. Re-run the full build/install (`npm run build-and-sync` or `npx claude-mem@latest install`) so all required files are generated.
  2. Inspect the missing files listed in the message and ensure each exists under the resolved root.
  3. If you passed a custom root via CLAUDE_PLUGIN_ROOT, point it at a complete plugin tree or unset it to use auto-detection.
  4. Run the install from the repo/package root as the message implies.

Example fix

# before — root missing plugin/.mcp.json
npx claude-mem@latest install --codex
# -> missing required files: plugin/.mcp.json

# after — regenerate the full layout
npm run build-and-sync
npx claude-mem@latest install --codex
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'fs';
import path from 'path';

const REQUIRED = [
  '.agents/plugins/marketplace.json',
  'plugin/.codex-plugin/plugin.json',
  'plugin/.mcp.json',
  'plugin/hooks/codex-hooks.json',
  'plugin/skills/mem-search/SKILL.md',
];

function marketplaceRootComplete(root: string): boolean {
  return REQUIRED.every((rel) => existsSync(path.join(root, rel)));
}

Type guard

function isMissingMarketplaceFilesError(e: unknown): boolean {
  return e instanceof Error && /Codex marketplace root .* is missing required files/i.test(e.message);
}

Try / catch

try {
  assertCodexMarketplaceRoot(root);
} catch (e) {
  if (e instanceof Error && /missing required files/.test(e.message)) {
    console.error(e.message);
    console.error('Run `npm run build-and-sync` (or npx claude-mem@latest install) and retry.');
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: resolvePluginMarketplaceRoot is called with an explicit preferredRoot (or a candidate resolves) but that directory lacks one or more of the required layout files. Triggered during the Codex install path when CLAUDE_PLUGIN_ROOT/PLUGIN_ROOT/cwd points at an incomplete checkout.

Common situations: Running the Codex installer from a shallow/partial clone; a build step that copies only some plugin artifacts; pointing CLAUDE_PLUGIN_ROOT at a staging dir missing hooks or skills; an interrupted build-and-sync left the tree half-populated.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12). Data as JSON: /api/errors/268fd7e9b8b6f8d0. Report an issue: GitHub.