{"record":{"id":"b36b0b317b8556c7","repo":"hcengineering/platform","slug":"export-failed-to-start","errorCode":null,"errorMessage":"Export failed to start","messagePattern":"Export failed to start","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/export-resources/src/components/ExportSettings.svelte","lineNumber":69,"sourceCode":"      const baseUrl = getMetadata(plugin.metadata.ExportUrl) ?? ''\n      const token = getMetadata(presentation.metadata.Token) ?? ''\n      const attributesOnly = selectedDetailLevel === 'attributesOnly'\n\n      const res = await fetch(`${baseUrl}/exportAsync?format=${selectedFormat}`, {\n        method: 'POST',\n        headers: {\n          Authorization: `Bearer ${token}`,\n          'Content-Type': 'application/json'\n        },\n        body: JSON.stringify({\n          _class: selectedClass,\n          attributesOnly,\n          config: {}\n        })\n      })\n\n      if (!res.ok) {\n        throw new Error('Export failed to start')\n      }\n\n      showPopup(MessageBox, {\n        label: plugin.string.ExportRequestSuccess,\n        kind: 'success',\n        message: plugin.string.ExportRequestSuccessMessage\n      })\n    } catch (err) {\n      showPopup(MessageBox, {\n        label: plugin.string.ExportRequestFailed,\n        kind: 'error',\n        message: plugin.string.ExportRequestFailedMessage\n      })\n    } finally {\n      isExporting = false\n    }\n  }\n</script>","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/export-resources/src/components/ExportSettings.svelte#L51-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"Export service down or misconfigured ExportUrl, invalid export options payload, expired auth token on the server side, or network proxy returning error responses.","solutions":["Inspect the response status/body (add logging) to identify whether it is 4xx (client/payload) or 5xx (server).","Verify ExportUrl metadata points to a healthy export service and the token is still valid.","Retry the export; if 5xx persists, check the export service logs and correct its configuration."],"exampleFix":"// before\nif (!res.ok) throw new Error('Export failed to start')\n// after\nif (!res.ok) {\n  const body = await res.text().catch(() => '')\n  console.error(`Export request failed: ${res.status} ${body}`)\n  throw new Error(`Export failed to start (HTTP ${res.status})`)\n}","handlingStrategy":"try-catch","validationCode":"// Preflight: verify service reachability and payload before posting\nconst url = getMetadata(plugin.metadata.ExportUrl)\nif (url == null) { ui.notify('Export service is not configured'); return }","typeGuard":"null","tryCatchPattern":"try {\n  const res = await fetch(`${baseUrl}/exportSync`, {...})\n  if (!res.ok) throw new Error(`Export failed to start (HTTP ${res.status})`)\n} catch (e) {\n  ui.notify(e instanceof Error ? e.message : 'Export failed to start')\n}","preventionTips":["Log response status and body for non-ok responses to diagnose 4xx vs 5xx quickly.","Health-check the export service URL during configuration.","Retry transient 5xx failures with backoff; surface persistent errors to the user."],"tags":["network","http","export"],"backgroundTag":"http-request-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}