{"record":{"id":"6aee7ae774daa1b2","repo":"musistudio/claude-code-router","slug":"plugin-marketplace-cached-module-is-missing-whil","errorCode":null,"errorMessage":"[plugin-marketplace] Cached module is missing while offline: ${moduleUrl}","messagePattern":"\\[plugin-marketplace\\] Cached module is missing while offline: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/plugins/marketplace.ts","lineNumber":254,"sourceCode":"    throw new Error(`Marketplace module must be an HTTPS URL: ${moduleUrl}`);\n  }\n\n  const extension = path.extname(url.pathname).toLowerCase();\n  if (![\".cjs\", \".js\", \".mjs\"].includes(extension)) {\n    throw new Error(`Marketplace module must be a JavaScript file: ${moduleUrl}`);\n  }\n\n  const expectedSha256 = normalizeSha256Integrity(integrity);\n  const cacheKey = expectedSha256 || hashString(moduleUrl);\n  const file = path.join(marketplaceModuleCacheDir, `${sanitizeFileSegment(id)}-${cacheKey.slice(0, 24)}${extension}`);\n  if (existsSync(file) && (options.offline || expectedSha256)) {\n    if (expectedSha256) {\n      verifySha256(readFileSync(file, \"utf8\"), expectedSha256, moduleUrl);\n    }\n    return file;\n  }\n  if (options.offline) {\n    console.warn(`[plugin-marketplace] Cached module is missing while offline: ${moduleUrl}`);\n    return undefined;\n  }\n\n  const source = await fetchText(moduleUrl, maxMarketplaceModuleBytes);\n  if (expectedSha256) {\n    verifySha256(source, expectedSha256, moduleUrl);\n  }\n  ensureMarketplaceCacheDir();\n  writeFileSync(file, source, \"utf8\");\n  return file;\n}\n\nasync function fetchText(url: string, maxBytes: number): Promise<string> {\n  assertHttpsUrl(url, \"Marketplace URL\");\n  const controller = new AbortController();\n  const timeout = setTimeout(() => controller.abort(), marketplaceFetchTimeoutMs);\n  try {\n    const response = await fetchWithSystemProxy(url, {","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/plugins/marketplace.ts#L236-L272","documentation":"The plugin marketplace resolver was asked for a module while in offline mode, and the module is not present in the local cache (or exists but its URL-keyed cache entry doesn't match). It warns and returns undefined, so the module cannot be loaded until connectivity returns or the module is cached.","triggerScenarios":"Running with options.offline=true and requesting a marketplace module URL never previously downloaded; cache cleared (or cache keyed by URL/hash changed); expected sha256 mismatch causing cache invalidation in offline runs.","commonSituations":"CI or air-gapped environments with offline=true but cache priming step skipped; cache directory wiped between runs; pinned module URL changed so the cache key misses.","solutions":["Run once online (offline=false) to populate the cache, then rerun offline","Pre-populate the cache in CI by downloading marketplace modules in a network-enabled step before the offline step","Verify the cache directory is persistent (not a tmpfs/ephemeral container layer) across runs","Confirm the moduleUrl matches the one used when the cache was primed"],"exampleFix":"# before (CI job)\nopencode --offline   # cache empty -> warning\n\n# after\ncache-step:\n  opencode plugins prefetch https://example.com/module.js  # network enabled\nrun-step:\n  opencode --offline","handlingStrategy":"validation","validationCode":"const cached = await marketplace.cachedModulePath(url, { offline: true });\nif (!cached) throw new Error(`Module ${url} not cached — prime the cache while online first`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prime the marketplace cache in a networked CI step before offline runs","Persist the cache directory across builds","Pin module URLs + sha256 so cache keys are stable"],"tags":["plugin-marketplace","offline-mode","cache"],"backgroundTag":"offline-cache-miss","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}