{"record":{"id":"9e29c2a858ab2875","repo":"paperclipai/paperclip","slug":"network","errorCode":"network","errorMessage":"Photon Cloud could not be reached; retry the connection","messagePattern":"Photon Cloud could not be reached; retry the connection","errorType":"error_code","errorClass":"PhotonError","httpStatus":null,"severity":"error","filePath":"server/src/services/photon/cloud.ts","lineNumber":136,"sourceCode":"    photonProjectIdSchema.parse(projectId);\n    if (!projectSecret || projectSecret.length > 4096)\n      throw new PhotonError(\"credentials\", \"Enter a Photon project secret\");\n    let response: Response;\n    try {\n      response = await this.fetchImpl(\n        `${CLOUD_ORIGIN}/projects/${encodeURIComponent(projectId)}/${suffix}`,\n        {\n          method,\n          redirect: \"error\",\n          signal: AbortSignal.timeout(15_000),\n          headers: {\n            authorization: `Basic ${Buffer.from(`${projectId}:${projectSecret}`).toString(\"base64\")}`,\n            accept: \"application/json\",\n          },\n        },\n      );\n    } catch {\n      throw new PhotonError(\n        \"network\",\n        \"Photon Cloud could not be reached; retry the connection\",\n      );\n    }\n    if (response.status === 401 || response.status === 403)\n      throw new PhotonError(\n        \"credentials\",\n        \"Photon rejected this project ID or secret\",\n      );\n    if (response.status === 429)\n      throw new PhotonError(\n        \"quota\",\n        \"Photon Cloud request limit reached; retry later\",\n      );\n    if (!response.ok)\n      throw new PhotonError(\n        \"network\",\n        `Photon Cloud returned HTTP ${response.status}`,","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/photon/cloud.ts#L118-L154","documentation":"Thrown by PhotonCloudClient.request when the fetch to https://spectrum.photon.codes throws (network failure, DNS failure, TLS error, or the 15-second AbortSignal timeout). The client converts any transport-level exception into a PhotonError with code 'network' telling the caller the Photon Cloud could not be reached and to retry.","triggerScenarios":"fetchImpl rejects: no internet/DNS resolution failure, spectrum.photon.codes unreachable, TLS handshake failure, or AbortSignal.timeout(15_000) fires before the response headers arrive; also redirect: 'error' turns an HTTP redirect into a fetch rejection.","commonSituations":"Corporate proxy or firewall blocks the Photon Cloud host; offline dev machine or container; Photon Cloud outage; slow response exceeding the 15s timeout; the Cloud endpoint starts redirecting (e.g. to a login page) after a service change.","solutions":["Verify basic connectivity: curl https://spectrum.photon.codes from the same host","Retry with backoff; the message explicitly frames this as transient","Check DNS/proxy settings (HTTPS_PROXY, corporate firewalls) that could block spectrum.photon.codes","Investigate whether requests consistently take >15s; if so the 15s AbortSignal.timeout is too tight for your environment","Check Photon status/announcements for an ongoing outage"],"exampleFix":"// before\nconst client = new PhotonCloudClient();\n// after: inject a custom fetch with proxy support or longer timeout\nconst client = new PhotonCloudClient((input, init) =>\n  fetch(input, { ...init, signal: AbortSignal.timeout(30_000) }));","handlingStrategy":"retry","validationCode":"// cheap preflight before Photon calls\nconst reachable = await fetch(\"https://spectrum.photon.codes\", { method: \"HEAD\", signal: AbortSignal.timeout(5000) }).then(r => r.ok).catch(() => false);\nif (!reachable) throw new Error(\"Photon Cloud unreachable from this host\");","typeGuard":"null","tryCatchPattern":"try {\n  return await cloud.inspect(projectId, secret);\n} catch (e) {\n  if (e instanceof PhotonError && e.code === \"network\")\n    return retryWithBackoff(() => cloud.inspect(projectId, secret), { attempts: 3, baseMs: 1000 });\n  throw e;\n}","preventionTips":["Run a connectivity preflight (HEAD request) before batch Photon operations","Use exponential backoff with jitter for network-class failures","Configure HTTPS_PROXY/firewall rules to allow spectrum.photon.codes","Increase the fetch timeout via a custom fetchImpl if your network is slow","Monitor Photon Cloud status for outages"],"tags":["network","timeout","fetch","photon-cloud","retryable"],"backgroundTag":"network-request-failed","analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-22T01:17:13.364Z"}