hcengineering/platform · error
Export failed
Error message
Export failed
What it means
The export job's outer/inner catch handlers: when the async export pipeline (WorkspaceExporter.export, archiving, target-client writes, notifications) throws, the route logs 'Export failed:' via measureCtx.error and responds 500 with { message: 'Export failed', error: err.message ?? 'Unknown error' }. Note the response of 200 'Export started' is sent before the async job runs, so callers usually observe this failure via logs/notifications rather than the HTTP response.
Source
Thrown at services/export/pod-export/src/server.ts:628
res.status(400).send({ message: 'No documents found to export' })
}
if (exportResult.success) {
await sendExportCompletionNotification(
measureCtx,
targetTxOps,
targetWorkspace,
targetWsIds,
exportResult.exportedDocuments,
wsIds,
_class
)
}
res.status(200).send({ message: 'Export completed' })
} catch (err: any) {
measureCtx.error('Export failed:', err)
res.status(500).send({ message: 'Export failed', error: err.message ?? 'Unknown error' })
} finally {
await sourceClient.close()
await targetClient.close()
}
} catch (err: any) {
measureCtx.error('Export to workspace request failed:', err)
const errorMessage = err instanceof ApiError ? err.message : 'Export to workspace request failed'
res.status(err instanceof ApiError ? err.code : 500).send({ message: errorMessage })
}
})
)
app.use((err: any, _req: any, res: any, _next: any) => {
measureCtx.warn(err)
if (err instanceof ApiError) {
res.status(err.code).send({ code: err.code, message: err.message })
return
}View on GitHub (pinned to 63e28dc964)
Solutions
- Read the measureCtx error log ('Export failed:' with the error) to identify the failing stage.
- Retry the export — storage blips are the most common cause; the finally block closes clients so state should be clean.
- Verify the target workspace client (targetClient) credentials/connectivity and that the sysToken's workspace is writable.
- Check free disk space and tmpdir writability on the export pod for archiving failures.
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight the source/target storage clients before starting an export await sourceClient.ping() await targetClient.ping() await fs.access(tmpdir(), fs.constants.W_OK)
Try / catch
try {
const res = await exportApi.exportToWorkspace(token, payload)
// HTTP 200 only means 'Export started' — poll for completion
await pollExportCompletion(res)
} catch (e) {
// job-level failures surface via logs/notifications: check measureCtx 'Export failed:' entries
console.error('export job failed', e)
await retryExportWithBackoff()
} Prevention
- Remember the route returns 200 before the async job runs — never treat 200 as success
- Pre-flight storage connectivity and disk space before large exports
- Monitor export pod logs and completion notifications for job outcomes
- Retry transient failures; the server closes clients in finally so retries start clean
When it happens
Trigger: Any exception during the background export: source/target storage client errors, hierarchy lookups failing on the _class, filesystem tmp-dir failures, zip archiving errors, or sendExportCompletionNotification throwing before res 200 in the inner flow.
Common situations: Transient storage outages mid-export, permissions on the temp directory, very large exports hitting memory/disk limits, platform client token issues for the generated sysToken, or notifications webhook failures.
Related errors
- ${errorBody?.error}
- Request failed
- ${error.error ?? text}
- Payment service error: ${response.status} ${text}
- Export failed to start
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/cce0662b38a36616.
Report an issue: GitHub.