hcengineering/platform · error
Failed to delete file
Error message
Failed to delete file
What it means
HulylakeStorage.deleteFile performs DELETE <baseUrl>/blob/<workspace>/<file> with a Bearer token and throws this generic Error if the response is not ok. The client throws away the status and body, so 401/403/404/5xx all surface as the same message.
Source
Thrown at foundations/core/packages/storage-client/src/client/hulylake.ts:54
return getPathname(url)
}
async getFileMeta (token: string, workspace: string, file: string): Promise<Record<string, any>> {
return {}
}
async deleteFile (token: string, workspace: string, file: string): Promise<void> {
const url = this.getFileUrl(workspace, file)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${token}`
}
})
if (!response.ok) {
throw new Error('Failed to delete file')
}
}
async uploadFile (
token: string,
workspace: string,
uuid: string,
file: File,
options?: FileStorageUploadOptions
): Promise<void> {
const url = this.getFileUrl(workspace, uuid)
await uploadXhr(
{
url,
method: 'PUT',
headers: {
Authorization: `Bearer ${token}`,View on GitHub (pinned to 63e28dc964)
Solutions
- Log or intercept response.status to determine whether it is auth (401/403), missing object (404) or server error (5xx).
- Refresh the Bearer token and retry once on auth failures.
- Verify workspace/file identifiers and that the baseUrl matches the deployed huly lake service.
- Retry with backoff on 5xx; treat 404 as already-deleted success if your workflow allows.
Example fix
// before
await storage.deleteFile(token, workspace, file) // 404 also throws
// after: tolerate already-deleted objects
try { await storage.deleteFile(token, workspace, file) }
catch { /* check meta; if absent, treat as deleted */ } Defensive patterns
Strategy: try-catch
Validate before calling
// verify the object exists and the config points at huly lake before deleting
const meta = await storage.getFileMeta(token, workspace, file)
if (Object.keys(meta).length === 0) return // already gone
console.assert(storageBaseUrl.includes('huly'), 'check baseUrl targets huly lake') Type guard
null
Try / catch
try {
await storage.deleteFile(token, workspace, file)
} catch (err) {
if (err instanceof Error && err.message === 'Failed to delete file') {
// probe status via a manual fetch to /meta to classify 401 vs 404 vs 5xx
} else throw err
} Prevention
- Match baseUrl to the deployed huly lake service per environment.
- Refresh tokens before scheduled deletion tasks.
- Skip (or log-and-continue) deletes of objects already absent.
- Add retries with backoff for 5xx responses.
When it happens
Trigger: deleteFile(token, workspace, file) receives a non-2xx: invalid/expired token, unknown workspace or file UUID, huly lake service error (500/503), or an ingress/proxy rejecting the DELETE.
Common situations: Env-specific baseUrl misconfiguration (pointing at datalake instead of huly lake); token obtained for a different workspace/region; object already deleted by a concurrent process; storage backend outage returning 503.
Related errors
- Failed to delete file
- Failed to delete file
- response.statusText
- Failed to fetch config
- unknownError(response.statusText)
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/1e02cbb922922800.
Report an issue: GitHub.