hcengineering/platform · error · Error

Export failed to start

Error message

Export failed to start

What it means

ExportSettings POSTs an export request to the export service and checks `res.ok`. When the server responds with a non-2xx status, 'Export failed to start' is thrown, meaning the backend refused or failed to create the export job. This is a server-side rejection surfaced to the UI.

Source

Thrown at plugins/export-resources/src/components/ExportSettings.svelte:69

      const baseUrl = getMetadata(plugin.metadata.ExportUrl) ?? ''
      const token = getMetadata(presentation.metadata.Token) ?? ''
      const attributesOnly = selectedDetailLevel === 'attributesOnly'

      const res = await fetch(`${baseUrl}/exportAsync?format=${selectedFormat}`, {
        method: 'POST',
        headers: {
          Authorization: `Bearer ${token}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          _class: selectedClass,
          attributesOnly,
          config: {}
        })
      })

      if (!res.ok) {
        throw new Error('Export failed to start')
      }

      showPopup(MessageBox, {
        label: plugin.string.ExportRequestSuccess,
        kind: 'success',
        message: plugin.string.ExportRequestSuccessMessage
      })
    } catch (err) {
      showPopup(MessageBox, {
        label: plugin.string.ExportRequestFailed,
        kind: 'error',
        message: plugin.string.ExportRequestFailedMessage
      })
    } finally {
      isExporting = false
    }
  }
</script>

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Inspect the response status/body (add logging) to identify whether it is 4xx (client/payload) or 5xx (server).
  2. Verify ExportUrl metadata points to a healthy export service and the token is still valid.
  3. Retry the export; if 5xx persists, check the export service logs and correct its configuration.

Example fix

// before
if (!res.ok) throw new Error('Export failed to start')
// after
if (!res.ok) {
  const body = await res.text().catch(() => '')
  console.error(`Export request failed: ${res.status} ${body}`)
  throw new Error(`Export failed to start (HTTP ${res.status})`)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Preflight: verify service reachability and payload before posting
const url = getMetadata(plugin.metadata.ExportUrl)
if (url == null) { ui.notify('Export service is not configured'); return }

Type guard

null

Try / catch

try {
  const res = await fetch(`${baseUrl}/exportSync`, {...})
  if (!res.ok) throw new Error(`Export failed to start (HTTP ${res.status})`)
} catch (e) {
  ui.notify(e instanceof Error ? e.message : 'Export failed to start')
}

Prevention

When it happens

Trigger: The fetch to the export endpoint returns HTTP 4xx/5xx — e.g. 400 bad payload (invalid config), 401/403 auth failure, or 500 on the export service.

Common situations: Export service down or misconfigured ExportUrl, invalid export options payload, expired auth token on the server side, or network proxy returning error responses.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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