hcengineering/platform · error

No such storage key

Error message

No such storage key

What it means

During file streaming in the files handler, storage errors whose message is 'No such key' or whose S3 error Code is 'NoSuchKey' are caught and surfaced as HTTP 404 with log 'No such storage key'. It is the mid-stream variant of error 905: the object disappeared or was never present when the actual read happened.

Source

Thrown at server/front/src/index.ts:557

              uuid,
              workspace: wsIds.uuid
            })
          }
        } catch (error: any) {
          if (error instanceof PlatformError && error.status.code === platform.status.Unauthorized) {
            res.status(401).send()
            return
          }
          if (
            error?.code === 'NoSuchKey' ||
            error?.code === 'NotFound' ||
            error?.message === 'No such key' ||
            error?.Code === 'NoSuchKey'
          ) {
            ctx.error('No such storage key', {
              file: req.query.file
            })
            res.status(404).send()
            return
          } else {
            ctx.error('error-handle-files', { error })
          }
          res.status(500).send()
        }
      },
      { url: req.path, query: req.query }
    )
  }

  app.get('/files', (req, res) => {
    void filesHandler(req, res)
  })

  app.head('/files/*', (req, res) => {
    void filesHandler(req, res)
  })

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Confirm the object key exists in the configured bucket (aws s3 ls / mc stat).
  2. Check bucket lifecycle/expiration rules that may auto-delete objects.
  3. Re-upload the missing object and retry the download.
  4. Verify the storage adapter points at the intended bucket/region.

Example fix

// before
const stream = await adapter.stream(ctx, wsIds, uuid)
// after
try {
  const stream = await adapter.stream(ctx, wsIds, uuid)
} catch (e) {
  if (e.Code === 'NoSuchKey') await reuploadAndRetry(uuid)
  else throw e
}
Defensive patterns

Strategy: retry

Validate before calling

async function ensureKeyExists(bucket: string, key: string): Promise<void> {
  const head = await s3.send(new HeadObjectCommand({ Bucket: bucket, Key: key }))
  if (head.$metadata.httpStatusCode !== 200) throw new Error(`missing object: ${key}`)
}

Type guard

function isNoSuchKey(err: unknown): err is { Code: 'NoSuchKey'; message?: string } {
  return typeof err === 'object' && err !== null &&
    ((err as any).Code === 'NoSuchKey' || (err as any).message === 'No such key')
}

Try / catch

try {
  return await streamFile(uuid)
} catch (err) {
  if (isNoSuchKey(err)) {
    await reuploadFile(uuid) // restore then retry once
    return await streamFile(uuid)
  }
  throw err
}

Prevention

When it happens

Trigger: Streaming a stored blob raises an error with message 'No such key' or Code 'NoSuchKey' — object deleted between stat and read, wrong key, or bucket inconsistency.

Common situations: Lifecycle/expiry policies deleting objects; concurrent deletion while downloading; cross-region/bucket replication lag; requesting keys from the wrong bucket.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/dda10fc44b869477. Report an issue: GitHub.