SubtitleEdit/subtitleedit · error · InvalidOperationException
Profile '{profileName}' not found in settings. Available: {a
Error message
Profile '{profileName}' not found in settings. Available: {available} What it means
Thrown by SeConvSettings.ApplyToLibSe when a profile name is supplied but the Profiles dictionary is null or has no matching key. Profiles are optional named overlays (under `profiles.<name>`) applied on top of the base settings sections; asking for one that was never defined is a configuration mistake. The message lists the available profile names so the caller can correct the value.
Source
Thrown at src/seconv/Core/SeConvSettings.cs:231
? Enumerable.Empty<string>()
: unknown.Keys.Select(key => prefix + key);
}
/// <summary>
/// Writes any non-null values from this object into libse's global Configuration.Settings.
/// When <paramref name="profileName"/> is provided, the named profile under <c>profiles.<name></c>
/// is overlaid on top of the base sections. Must be called before any conversion runs.
/// </summary>
public void ApplyToLibSe(string? profileName = null)
{
ApplyBaseSections();
if (!string.IsNullOrWhiteSpace(profileName))
{
if (Profiles is null || !Profiles.TryGetValue(profileName, out var profile))
{
var available = Profiles is null ? "(none defined)" : string.Join(", ", Profiles.Keys);
throw new InvalidOperationException($"Profile '{profileName}' not found in settings. Available: {available}");
}
profile.ApplyBaseSections();
}
}
/// <summary>
/// Overlays the <c>exportImages</c> section (base first, then the named profile's, if any)
/// onto <paramref name="style"/>. Unlike the other sections this does not go through
/// libse's Configuration — image rendering is driven by <see cref="ImageExportStyle"/>
/// on <c>ConversionOptions</c>. Call after <see cref="ApplyToLibSe"/>, which validates
/// the profile name.
/// </summary>
public void ApplyExportImages(ImageExportStyle style, string? profileName = null)
{
ExportImages?.ApplyTo(style);
if (!string.IsNullOrWhiteSpace(profileName) &&
Profiles is not null &&View on GitHub (pinned to 17a9f07487)
Solutions
- Read the 'Available' list in the error message and use one of those names exactly.
- Add the profile under `profiles.<name>` in the settings file (use `seconv dump-settings` for the schema).
- Drop the `--profile` flag to use only the base settings.
- Check key casing — dictionary lookup is case-sensitive.
Example fix
// settings.json has profiles.dev but not profiles.production // before seconv in.srt out.srt --settings=s.json --profile=production // after seconv in.srt out.srt --settings=s.json --profile=dev
Defensive patterns
Strategy: validation
Validate before calling
if (!string.IsNullOrWhiteSpace(profileName) &&
(settings.Profiles is null || !settings.Profiles.ContainsKey(profileName)))
throw new ArgumentException("Unknown profile: " + profileName +
". Defined: " + (settings.Profiles is null ? "(none)" : string.Join(",", settings.Profiles.Keys))); Type guard
static bool ProfileExists(SeConvSettings s, string? name) =>
string.IsNullOrWhiteSpace(name) || (s.Profiles is not null && s.Profiles.ContainsKey(name!)); Try / catch
try { settings.ApplyToLibSe(profileName); }
catch (InvalidOperationException ex) when (ex.Message.Contains("not found in settings"))
{
// read Available list, pick a valid name or proceed without a profile
} Prevention
- List available profiles from settings.Profiles.Keys before applying.
- Treat profile names as case-sensitive in documentation.
- Add a CI test that every documented profile exists in the shipped settings.
When it happens
Trigger: Calling `settings.ApplyToLibSe(profileName)` (via `--profile <name>`) where `profileName` is not a key in the settings file's `profiles` object, or where no `profiles` section exists at all.
Common situations: Typoing the profile name; profile defined under a different casing (matching is case-sensitive on dictionary keys); copy-paste of a profile name from a different settings file; the profiles section was deleted but the --profile flag was kept.
Related errors
- Settings file not found: {path}
- Translate engine '{options.TranslateEngine}' is not supporte
- Translate model '{name}' not found in {LlamaCppServerManager
- BinaryOCR database not found: {dbPath}. Use --ocr-db to poin
- nOCR database not found: {nOcrDbPath}. Use --ocr-db to point
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/f82f2ccbea61ebb7.
Report an issue: GitHub.