{"record":{"id":"a8f4be3dbec658ec","repo":"hcengineering/platform","slug":"get-file-error-a8f4be","errorCode":null,"errorMessage":"get-file-error","messagePattern":"get-file-error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/front/src/index.ts","lineNumber":241,"sourceCode":"        await new Promise<void>((resolve, reject) => {\n          dataStream.on('end', function () {\n            res.end()\n            dataStream.destroy()\n            resolve()\n          })\n          dataStream.on('error', function (err) {\n            Analytics.handleError(err)\n            ctx.error('error', { err })\n\n            res.end()\n            dataStream.destroy()\n            reject(err)\n          })\n        })\n      } catch (err: any) {\n        ctx.error('get-file-error', { workspace: wsIds.uuid, err })\n        Analytics.handleError(err)\n        res.status(500).send()\n      }\n    },\n    {}\n  )\n}\n\n/**\n * @public\n * @param port -\n */\nexport function start (\n  ctx: MeasureContext,\n  config: {\n    storageAdapter: StorageAdapter\n    accountsUrl: string\n    accountsUrlInternal?: string\n    uploadUrl: string\n    filesUrl: string","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/server/front/src/index.ts#L223-L259","documentation":"In the front server's getFile handler, any error thrown while reading a file from storage for a workspace is logged as 'get-file-error' and converted to an HTTP 500 response. It is a generic wrapper around storage read failures (storage adapter errors, network issues to storage backend, permission problems).","triggerScenarios":"config.storageAdapter getFile operation throws or rejects during GET/HEAD file requests (bucket unreachable, key access error, adapter misconfiguration).","commonSituations":"S3/MinIO credentials invalid or expired; storage bucket misconfigured; network partition between front server and object storage; oversized/corrupted objects.","solutions":["Inspect the logged err object in ctx.error output to find the underlying storage failure.","Verify storage adapter configuration (endpoint, credentials, bucket) in the front server config.","Check connectivity from the front server to the object storage backend.","Retry the file request once storage is confirmed healthy."],"exampleFix":"// before (config)\nendpoint: 'http://old-minio:9000'\n// after\nendpoint: process.env.STORAGE_ENDPOINT // correct reachable endpoint with valid creds","handlingStrategy":"try-catch","validationCode":"// Preflight storage reachability before requesting files\nconst healthy = await fetch(`${storageEndpoint}/minio/health/live`)\nif (!healthy.ok) throw new Error('storage backend unreachable')","typeGuard":"function isStorageError(err: unknown): err is Error & { code?: string } {\n  return err instanceof Error\n}","tryCatchPattern":"try {\n  const res = await fetch(fileUrl)\n  if (!res.ok) throw new Error(`file fetch failed: ${res.status}`)\n  return await res.blob()\n} catch (err) {\n  console.error('get-file-error', err)\n  throw new Error('File download failed; check storage adapter config and connectivity')\n}","preventionTips":["Validate storage adapter config (endpoint, credentials, bucket) at service startup.","Monitor storage backend health and alert before client requests fail.","Include the underlying error details from the 'get-file-error' log when debugging, not just the 500."],"tags":["http-500","storage","file-download"],"backgroundTag":"storage-read-failure","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}