{"record":{"id":"7a50e0a73b98613c","repo":"semaphoreui/semaphore","slug":"failed-to-export-s-s","errorCode":null,"errorMessage":"failed to export %s: %s","messagePattern":"failed to export (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/export/Exporter.go","lineNumber":495,"sourceCode":"\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor _, name := range keys {\n\t\tprogress := &ProgressBar{printer: func(progress float32, count int64) {\n\t\t\tstrLen := len(name)\n\t\t\tspaces := fmt.Sprintf(\"%*s\", 45-strLen, \" \")\n\n\t\t\tfmt.Printf(\"\\rExporting %s%s %d%%\", name, spaces, int(progress*100))\n\t\t}, progress: 0}\n\n\t\tprogress.updateForce(0, 0)\n\t\texporter := p.exporters[name]\n\t\terr = exporter.load(store, p, progress)\n\t\tif err != nil {\n\t\t\tfmt.Println()\n\t\t\treturn fmt.Errorf(\"failed to export %s: %s\", name, err.Error())\n\t\t}\n\t\tprogress.updateForce(1, progress.count)\n\t\tfmt.Println()\n\t}\n\treturn\n}\n\nfunc (p *ExporterChain) Restore(store db.Store, errLogSize int) error {\n\tkeys, err := getSortedKeys(p.exporters, func(t TypeExporter) []string {\n\t\treturn t.importDependsOn()\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, name := range keys {\n\n\t\tprogress := &ProgressBar{printer: func(progress float32, count int64) {","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/services/export/Exporter.go#L477-L513","documentation":"The export runner wraps each exporter's load() failure with the failing type name, producing 'failed to export <type>: <cause>'. It is a wrapper error — the root cause is the inner exporter's error (e.g. a DB failure, 'values not loaded', or 'duplicate key').","triggerScenarios":"During Export(), exporter.load(store, p, progress) returns an error for the type `name`; the chain aborts the whole export and returns the wrapped message.","commonSituations":"Database connectivity problems during export; a type's load hitting 'values not loaded' or 'duplicate key'; permission issues reading from the store mid-export.","solutions":["Read the inner error after 'failed to export <type>:' and fix that root cause first","Verify database connectivity and permissions before re-running the export","Re-run the export for the failing type in isolation to reproduce and debug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight: verify store connectivity before export\nif err := store.Ping(); err != nil {\n    return fmt.Errorf(\"store unavailable, export will fail: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := chain.Export(store)\nif err != nil {\n    var inner error\n    if strings.HasPrefix(err.Error(), \"failed to export \") {\n        parts := strings.SplitN(err.Error(), \": \", 2)\n        inner = errors.New(parts[1]) // root cause\n    }\n    log.Errorf(\"export failed: %v (cause: %v)\", err, inner)\n    return err\n}","preventionTips":["Always chase the wrapped inner error for the real cause","Monitor exporter.getErrors() after each run","Test exports against staging data regularly"],"tags":["go","export","error-wrapping"],"backgroundTag":"export-failed","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}