SubtitleEdit/subtitleedit · error · InvalidOperationException
Unknown type of event #{i + 1}: '{type}'
Error message
Unknown type of event #{i + 1}: '{type}' What it means
Thrown by ClqttJson.LoadSubtitle when an entry in the events array has an eventType other than 'TIMED_TEXT_EVENT'. The importer only knows how to handle timed text events, so any other event type (or a missing/empty eventType field) aborts processing of that file.
Source
Thrown at src/libse/SubtitleFormats/ClqttJson.cs:96
}
}
}
var eventsElement = rootElements.Find(element => element.Name.Equals("events", StringComparison.InvariantCultureIgnoreCase));
if (eventsElement != null)
{
var eventElements = parser.GetRootElements(eventsElement.Json);
for (var i = 0; i < eventElements.Count; i++)
{
try
{
var eventJson = eventElements[i].Json;
var type = parser.GetFirstObject(eventJson, "eventType");
if (!type.Equals("TIMED_TEXT_EVENT", StringComparison.InvariantCultureIgnoreCase))
{
throw new InvalidOperationException($"Unknown type of event #{i + 1}: '{type}'");
}
var startString = parser.GetFirstObject(eventJson, "start");
var endString = parser.GetFirstObject(eventJson, "end");
var textString = parser.GetFirstObject(eventJson, "txt");
var region = parser.GetFirstObject(eventJson, "rgn");
var styles = parser.GetArrayElementsByName(eventJson, "styles");
var annotations = new List<string>();
var eventRootElements = parser.GetRootElements(eventJson);
var annotationsElement = eventRootElements.Find(element => element.Name.Equals("annotations", StringComparison.InvariantCultureIgnoreCase));
if (annotationsElement != null)
{
var annotationElements = parser.GetRootElements(annotationsElement.Json);
if (annotationElements != null && annotationElements.Count > 0)
{
foreach (var annotationElement in annotationElements)
{View on GitHub (pinned to 17a9f07487)
Solutions
- Open the .clqtt file and ensure every element in events[] has "eventType": "TIMED_TEXT_EVENT".
- Remove or filter out non-text events before import.
- Convert the file with its source tool to a format SubtitleEdit fully supports.
- Upgrade SubtitleEdit for broader event-type coverage.
Example fix
// before
{ "eventType": "NOTE", "txt": "..." }
// after
{ "eventType": "TIMED_TEXT_EVENT", "txt": "..." } Defensive patterns
Strategy: validation
Validate before calling
// Pre-filter events to only TIMED_TEXT_EVENT entries
foreach (var evt in eventElements)
{
var type = parser.GetFirstObject(evt.Json, "eventType");
if (!type.Equals("TIMED_TEXT_EVENT", StringComparison.OrdinalIgnoreCase))
{
// skip or log non-text events instead of failing the whole import
continue;
}
// process evt
} Try / catch
try
{
new ClqttJson().LoadSubtitle(sub, lines, fileName);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("Unknown type of event"))
{
logger.Warning(ex.Message); // report and skip the file
} Prevention
- Strip non-text events from CLQTT files before import.
- Validate the eventType of each entry in a pre-pass.
- Upgrade SubtitleEdit when new event types are added.
When it happens
Trigger: A .clqtt events array containing entries with eventType set to something like 'NOTE', 'COMMENT', 'IMAGE', or an empty string. The check is case-insensitive but exact on the string value.
Common situations: CLQTT files that embed non-text events (images, styling notes); files from a newer spec revision; producer tools that emit a different event taxonomy.
Related errors
- Unknown time format '{timeFormat}'
- Element 'events' not found.
- Parse error in event #{i + 1} style: {ex.Message}
- Parse error in event #{i + 1}: {ex.Message}
- Invalid ASSA time code: {time}
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/4e5cce05e4084054.
Report an issue: GitHub.