{"record":{"id":"33daab3a4495046f","repo":"NickeManarin/ScreenToGif","slug":"missing-upload-preset-called-preset-uploadservice","errorCode":null,"errorMessage":"Missing upload preset called {preset.UploadService}","messagePattern":"Missing upload preset called (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"ScreenToGif/Util/EncodingManager.cs","lineNumber":1160,"sourceCode":"\n                Update(id, EncodingStatus.Canceled);\n                return;\n            }\n\n            #region Upload\n\n            if (preset.UploadFile && File.Exists(preset.FullPath))\n            {\n                Update(id, \"S.Encoder.Uploading\", true, true);\n\n                try\n                {\n                    //Get selected preset.\n                    var presetType = preset.Extension == \".zip\" ? ExportFormats.Zip : preset.Type;\n                    var uploadPreset = UserSettings.All.UploadPresets.OfType<UploadPreset>().FirstOrDefault(f => (f.AllowedTypes.Count == 0 || f.AllowedTypes.Contains(presetType)) && f.Title == preset.UploadService);\n\n                    if (uploadPreset == null)\n                        throw new Exception($\"Missing upload preset called {preset.UploadService}\");\n\n                    //TODO: Limit upload by imposed service limits.\n\n                    //Try uploading to the selected service.\n                    var cloud = CloudFactory.CreateCloud(uploadPreset.Type);\n                    var history = await cloud.UploadFileAsync(uploadPreset, preset.FullPath, CancellationToken.None);\n\n                    uploadPreset.History.Add(history);\n                    UserSettings.Save();\n\n                    if (history.Result != 200)\n                        throw new Exception(history.Message);\n\n                    SetUpload(id, true, history.GetLink(uploadPreset), history.DeletionLink);\n                }\n                catch (Exception e)\n                {\n                    LogWriter.Log(e, \"It was not possible to upload.\");","sourceCodeStart":1142,"sourceCodeEnd":1178,"githubUrl":"https://github.com/NickeManarin/ScreenToGif/blob/a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd/ScreenToGif/Util/EncodingManager.cs#L1142-L1178","documentation":"EncodingManager resolves the upload destination by finding a UploadPreset in UserSettings.All.UploadPresets whose AllowedTypes permits the export type AND whose Title equals preset.UploadService. If no preset matches, it throws — the export preset references an upload service name that no longer exists in settings.","triggerScenarios":"preset.UploadFile == true and an output file exists, but the LINQ FirstOrDefault over UploadPresets returns null because no entry's Title == preset.UploadService (with AllowedTypes compatibility).","commonSituations":"User deleted or renamed the upload preset but the export preset still records the old UploadService name; settings file corrupted/partially migrated; preset was imported from another machine; AllowedTypes list excludes the current export type.","solutions":["Recreate the upload preset whose Title matches preset.UploadService, or edit the export preset to point at an existing upload preset.","If AllowAny type is acceptable, clear the matching preset's AllowedTypes so it accepts all formats.","Validate preset.UploadService against UserSettings.All.UploadPresets in the export panel before starting the encode.","If the upload preset is optional, clear preset.UploadFile so the export skips the upload step."],"exampleFix":"// before\nvar uploadPreset = UserSettings.All.UploadPresets.OfType<UploadPreset>().FirstOrDefault(f => (f.AllowedTypes.Count == 0 || f.AllowedTypes.Contains(presetType)) && f.Title == preset.UploadService);\nif (uploadPreset == null)\n    throw new Exception($\"Missing upload preset called {preset.UploadService}\");\n\n// after\nvar uploadPreset = UserSettings.All.UploadPresets.OfType<UploadPreset>().FirstOrDefault(f => (f.AllowedTypes.Count == 0 || f.AllowedTypes.Contains(presetType)) && f.Title == preset.UploadService);\nif (uploadPreset == null)\n    throw new Exception($\"Missing upload preset called '{preset.UploadService}'. Available: {string.Join(\", \", UserSettings.All.UploadPresets.OfType<UploadPreset>().Select(p => p.Title))}.\");","handlingStrategy":"validation","validationCode":"// In the export panel, validate UploadService before enabling 'Upload'\nvar match = UserSettings.All.UploadPresets.OfType<UploadPreset>()\n    .FirstOrDefault(p => p.Title == exportPreset.UploadService &&\n                         (p.AllowedTypes.Count == 0 || p.AllowedTypes.Contains(exportPreset.Type)));\nif (match == null) /* block upload / surface a 'missing preset' warning */","typeGuard":"bool UploadServiceIsConfigured(ExportPreset ep) =>\n    UserSettings.All.UploadPresets.OfType<UploadPreset>().Any(p => p.Title == ep.UploadService);","tryCatchPattern":"try { /* upload */ }\ncatch (Exception ex) when (ex.Message.StartsWith(\"Missing upload preset\"))\n{ /* open Upload settings so the user can recreate the preset */ }","preventionTips":["Cascade-delete: when a user removes an upload preset, clear any export preset's UploadService that referenced it.","Validate the upload preset name in the export panel before the encode starts.","Show available preset names in the error so the user can correct the reference."],"tags":["upload","settings","configuration","encoding"],"backgroundTag":null,"analyzedSha":"a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd","analyzedAt":"2026-08-13T11:12:06.147Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}