{"record":{"id":"947f27af937e4a5e","repo":"overleaf/overleaf","slug":"nothing-cached-yet","errorCode":null,"errorMessage":"nothing cached yet","messagePattern":"nothing cached yet","errorType":"http","errorClass":"NotFoundError","httpStatus":404,"severity":"warning","filePath":"services/web/app/src/Features/Compile/ClsiCacheHandler.mjs","lineNumber":234,"sourceCode":"        shard: headers.get('X-Shard') || 'cache',\n        lastModified: new Date(headers.get('X-Last-Modified')),\n        size: parseInt(headers.get('X-Content-Length'), 10),\n        allFiles: JSON.parse(allFilesRaw),\n      }\n    } catch (err) {\n      if (err instanceof RequestFailedError && err.response.status === 404) {\n        lastFailures.delete(url) // The shard is back up.\n        break // No clsi-cache instance has cached something for this project/user.\n      }\n      lastFailures.set(url, performance.now()) // The shard is unhealthy. Refresh timestamp of last failure.\n      logger.warn(\n        { err, projectId, userId, url, shard },\n        'getLatestOutputFile from clsi-cache failed'\n      )\n      // This clsi-cache instance is down, try the next backend.\n    }\n  }\n  throw new NotFoundError('nothing cached yet')\n}\n\n/**\n * Populate the clsi-cache for the given project/user with the provided source\n *\n * This is either another project, or a template (id+version).\n *\n * @param projectId\n * @param userId\n * @param sourceProjectId\n * @param templateVersionId\n * @param imageName\n * @param lastUpdated\n * @param shard\n * @param signal\n * @return {Promise<void>}\n */\nasync function prepareCacheSource(","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/app/src/Features/Compile/ClsiCacheHandler.mjs#L216-L252","documentation":"getRedirectWithFallback iterates the configured backends (clsi-cache instances) trying getLatestOutputFile; if every backend fails or returns nothing, it concludes no compile output is cached anywhere and throws NotFoundError('nothing cached yet'). It is an expected 'cold cache' signal, not a malfunction.","triggerScenarios":"Requesting the latest output file redirect when no clsi-cache backend has an entry for the project/user: first compile after deployment, cache eviction/expiry, or all cache shards unreachable (swallowed per-shard errors).","commonSituations":"Fresh project with no prior compile; clsi-cache restarted with empty storage; cache TTL expired; user-id mismatch between the populate and lookup calls.","solutions":["Trigger a compile first (call ClsiManager) so output gets populated, then request the cached file","Verify the same projectId/userId pair used at populate time is used for lookup","Check clsi-cache availability and logs — if all shards were down, the cache was simply never consulted","Treat this error as 'cache miss' and fall back to the normal clsi output endpoint"],"exampleFix":"// before\nconst url = await ClsiCacheHandler.promises.getRedirectWithFallback(projectId, userId, file)\n// after\nlet url\ntry {\n  url = await ClsiCacheHandler.promises.getRedirectWithFallback(projectId, userId, file)\n} catch (err) {\n  if (err instanceof NotFoundError) {\n    url = await compileAndGetOutputDirectly(projectId, userId, file)\n  } else { throw err }\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  url = await ClsiCacheHandler.promises.getRedirectWithFallback(projectId, userId, file)\n} catch (err) {\n  if (err instanceof NotFoundError) {\n    url = await getClsiOutputDirectly(projectId, userId, file)\n  } else { throw err }\n}","preventionTips":["Trigger a compile before requesting cached output","Monitor clsi-cache health — all shards down silently degrades to this error","Use consistent projectId/userId between populate and lookup calls"],"tags":["cache-miss","compile","not-found","fallback"],"backgroundTag":"cache-miss","analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}