Flow-Launcher/Flow.Launcher · error · ArgumentException
DoublePinyinSchema '{schemaKey}' is invalid or double pinyin
Error message
DoublePinyinSchema '{schemaKey}' is invalid or double pinyin table is broken. What it means
Thrown as ArgumentException when the deserialized table is a valid non-null Dictionary but does not contain a key matching _settings.DoublePinyinSchema.ToString(). The schema name (an enum value, e.g. a custom schema) must exist as a top-level key in double_pinyin.json or the table cannot be selected. Like error 10, this propagates uncaught from CreateDoublePinyinTableFromStream.
Source
Thrown at Flow.Launcher.Infrastructure/PinyinAlphabet.cs:61
}
};
}
public void Reload()
{
LoadDoublePinyinTable();
_pinyinCache.Clear();
}
private void CreateDoublePinyinTableFromStream(Stream jsonStream)
{
var table = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, string>>>(jsonStream) ??
throw new InvalidOperationException("Failed to deserialize double pinyin table: result is null");
var schemaKey = _settings.DoublePinyinSchema.ToString();
if (!table.TryGetValue(schemaKey, out var schemaDict))
{
throw new ArgumentException($"DoublePinyinSchema '{schemaKey}' is invalid or double pinyin table is broken.");
}
currentDoublePinyinTable = new ReadOnlyDictionary<string, string>(schemaDict);
}
private void LoadDoublePinyinTable()
{
if (!_settings.UseDoublePinyin)
{
currentDoublePinyinTable = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>());
return;
}
var tablePath = Path.Combine(AppContext.BaseDirectory, "Resources", "double_pinyin.json");
try
{
using var fs = File.OpenRead(tablePath);
CreateDoublePinyinTableFromStream(fs);View on GitHub (pinned to 7fc63b07bb)
Solutions
- Open Resources/double_pinyin.json and confirm there is a top-level key whose name matches the selected DoublePinyinSchema enum value's ToString().
- Reset the DoublePinyinSchema setting to a known-supported schema (e.g. the default).
- If you added a custom enum value, add a matching schema section to the JSON file.
- Restore the resource file from the official install to rule out manual edits.
Example fix
// before — hard fail on unknown schema
if (!table.TryGetValue(schemaKey, out var schemaDict))
throw new ArgumentException($"DoublePinyinSchema '{schemaKey}' is invalid...");
// after — fall back to first available schema and log
if (!table.TryGetValue(schemaKey, out var schemaDict))
{
Log.Warn(nameof(PinyinAlphabet), $"Schema '{schemaKey}' not found; falling back");
schemaDict = table.Values.FirstOrDefault() ?? new Dictionary<string,string>();
} Defensive patterns
Strategy: validation
Validate before calling
var schemaKey = _settings.DoublePinyinSchema.ToString();
using var fs = File.OpenRead(tablePath);
var table = JsonSerializer.Deserialize<Dictionary<string,Dictionary<string,string>>>(fs);
if (table is null || !table.ContainsKey(schemaKey))
{ Log.Warn(...); currentDoublePinyinTable = Empty; return; } Type guard
null
Try / catch
try { CreateDoublePinyinTableFromStream(fs); }
catch (ArgumentException ex) when (ex.Message.Contains("DoublePinyinSchema"))
{ Log.Exception(...); currentDoublePinyinTable = Empty; } Prevention
- When adding a new DoublePinyinSchema enum value, add its key mapping to the JSON resource in the same change.
- Reset the schema setting to a known-supported value if errors appear after an update.
- Keep schema key names consistent with the enum's ToString().
- Validate the resource file is intact before relying on a custom schema.
When it happens
Trigger: User selected a DoublePinyinSchema enum value whose string name is not present as a key in double_pinyin.json; the enum was extended with a new schema but the resource file wasn't updated; the schema's ToString() casing doesn't match the JSON key; the table JSON was edited and a schema section deleted.
Common situations: Version skew: a newer build references a schema enum not in the shipped resource; user manually edited double_pinyin.json and removed a schema; a plugin/extension added a schema enum without providing its key mapping; enum renamed but JSON not migrated.
Related errors
- Failed to deserialize double pinyin table: result is null
- Invalid file path
- Invalid corner type
- The zip file does not contain a plugin.json file.
- Theme path can't be found <{path}>
AI-assisted analysis of Flow-Launcher/Flow.Launcher@7fc63b07bb (2026-08-13).
Data as JSON: /api/errors/a01927fceac8ccea.
Report an issue: GitHub.