musistudio/claude-code-router · warning

[plugin-marketplace] Failed to read cached marketplace

Error message

[plugin-marketplace] Failed to read cached marketplace: ${formatError(error)}

What it means

Emitted by readCachedMarketplace when the on-disk marketplace cache cannot be read or parsed: the file is missing is handled earlier, but a read error, truncated file, or invalid JSON lands here. The function then returns an empty list, so the marketplace shows no entries.

Solutions

  1. Delete the cache file (marketplaceManifestCacheFile) so the next successful online fetch rewrites it.
  2. Ensure at least one online run completes so a fresh valid cache is produced.
  3. If it recurs, capture the formatted error — a normalize error may indicate a schema change requiring a package upgrade.

Example fix

rm ~/.cache/<app>/marketplace/marketplace.json # path = marketplaceManifestCacheFile
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: The cache file exists but is corrupt — partial write from a crash, manual editing, disk corruption — or a normalizeMarketplaceManifest validation error in offline mode.

Common situations: Process killed while writeFileSync was updating the cache; user hand-edited the cache file; cache written by an older incompatible package version.

Related errors


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/1d927d2bbf4aff22. Report an issue: GitHub.

Appendix: source

Thrown at packages/core/src/plugins/marketplace.ts:78

    ensureMarketplaceCacheDir();
    writeFileSync(marketplaceManifestCacheFile, source, "utf8");
    return normalizeMarketplaceManifest(JSON.parse(source) as unknown, url);
  } catch (error) {
    console.warn(`[plugin-marketplace] Failed to fetch marketplace from ${url}: ${formatError(error)}`);
    return readCachedMarketplace(url);
  }
}

async function readCachedMarketplace(url: string): Promise<PluginMarketplaceEntry[]> {
  if (!existsSync(marketplaceManifestCacheFile)) {
    return [];
  }

  try {
    const source = readFileSync(marketplaceManifestCacheFile, "utf8");
    return normalizeMarketplaceManifest(JSON.parse(source) as unknown, url, { offline: true });
  } catch (error) {
    console.warn(`[plugin-marketplace] Failed to read cached marketplace: ${formatError(error)}`);
    return [];
  }
}

async function normalizeMarketplaceManifest(
  value: unknown,
  manifestUrl: string,
  options: { offline?: boolean } = {}
): Promise<PluginMarketplaceEntry[]> {
  const items = marketplaceItems(value);
  const entries: PluginMarketplaceEntry[] = [];
  const seen = new Set<string>();

  for (const item of items) {
    let entry: PluginMarketplaceEntry | undefined;
    try {
      entry = await normalizeMarketplaceEntry(item, manifestUrl, options);
    } catch (error) {

View on GitHub (pinned to 99f24806c6)