{"record":{"id":"8086fed1a2f41de1","repo":"SubtitleEdit/subtitleedit","slug":"unknown-subtitle-format-formatname","errorCode":null,"errorMessage":"Unknown subtitle format: {formatName}","messagePattern":"Unknown subtitle format: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/LibSEIntegration.cs","lineNumber":454,"sourceCode":"            File.WriteAllText(filePath, sb.ToString(), plainEncoding);\n            return;\n        }\n\n        // Image-based output formats: render text → bitmaps → format-specific bytes\n        var imageHandler = ImageOutputWriter.TryCreateHandler(formatName);\n        if (imageHandler is not null)\n        {\n            var outputDirImg = Path.GetDirectoryName(filePath);\n            if (!string.IsNullOrEmpty(outputDirImg) && !Directory.Exists(outputDirImg))\n            {\n                Directory.CreateDirectory(outputDirImg);\n            }\n            ImageOutputWriter.Write(subtitle, filePath, imageHandler, options ?? throw new InvalidOperationException(\"Image-based formats require ConversionOptions\"));\n            return;\n        }\n\n        var targetFormat = ResolveFormatByName(formatName)\n            ?? throw new InvalidOperationException($\"Unknown subtitle format: {formatName}\");\n\n        // Strip native source-format markup that the target wouldn't understand\n        if (sourceFormat != null && !sourceFormat.GetType().Equals(targetFormat.GetType()))\n        {\n            targetFormat.RemoveNativeFormatting(subtitle, sourceFormat);\n        }\n\n        var outputDir = Path.GetDirectoryName(filePath);\n        if (!string.IsNullOrEmpty(outputDir) && !Directory.Exists(outputDir))\n        {\n            Directory.CreateDirectory(outputDir);\n        }\n\n        // Ebu (binary) — optional header file\n        if (targetFormat is Ebu ebu)\n        {\n            Ebu.EbuGeneralSubtitleInformation? header = null;\n            if (!string.IsNullOrEmpty(ebuHeaderFile))","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/LibSEIntegration.cs#L436-L472","documentation":"Thrown when the requested output format name does not match any registered subtitle format AND is not recognized as an image-based format by TryCreateHandler. ResolveFormatByName returns null for unrecognized names, and the ?? throw fires. This is a user-facing format identifier error — the formatName string could not be resolved to any SubtitleFormat or image handler.","triggerScenarios":"Calling the save path with a formatName that is misspelled, uses the wrong casing/dialect, or names a format the bundled LibSE version does not support. The image handler lookup (TryCreateHandler) also returned null, so it is neither a text nor image format.","commonSituations":"Typo in the format name on the CLI (e.g. 'srtt' instead of 'srt'); using an informal name vs the canonical one (e.g. 'ssa' vs 'Advanced Sub Station Alpha'); requesting a format added in a newer LibSE build than the one seconv bundles.","solutions":["Check the exact format name spelling and casing — use the format list/enum from seconv's documentation or --help output.","If unsure of the canonical name, try common aliases (e.g. 'SubRip', 'srt', 'SRT').","Update seconv to the latest version — the format may have been added recently."],"exampleFix":"// before\nLibSEIntegration.SaveSubtitle(sub, outPath, \"subrib\", options);\n\n// after\nLibSEIntegration.SaveSubtitle(sub, outPath, \"srt\", options); // or \"SubRip\"","handlingStrategy":"validation","validationCode":"var resolved = LibSEIntegration.ResolveFormatByName(formatName);\nif (resolved == null && ImageOutputWriter.TryCreateHandler(formatName) == null)\n    throw new InvalidOperationException($\"Unknown subtitle format: {formatName}\");","typeGuard":"static bool IsKnownFormat(string formatName) => LibSEIntegration.ResolveFormatByName(formatName) != null || ImageOutputWriter.TryCreateHandler(formatName) != null;","tryCatchPattern":"try { LibSEIntegration.SaveSubtitle(sub, outPath, formatName, options); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Unknown subtitle format\"))\n{ /* list supported formats, prompt user for correct name */ }","preventionTips":["Validate format names against the known list before calling Save.","Use the canonical format names from seconv's documentation or --help.","Normalize user input (trim, case-insensitive) before format resolution."],"tags":["format-detection","invalid-argument","validation","subtitles"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}