{"record":{"id":"2c3576370452f669","repo":"pot-app/pot-desktop","slug":"language-not-supported-2c3576","errorCode":null,"errorMessage":"Language not supported","messagePattern":"Language not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/window/Translate/components/TargetArea/index.jsx","lineNumber":346,"sourceCode":"\n    // refresh tts config\n    useEffect(() => {\n        if (ttsServiceList && getServiceSouceType(ttsServiceList[0]) === ServiceSourceType.PLUGIN) {\n            readTextFile(`plugins/tts/${getServiceName(ttsServiceList[0])}/info.json`, {\n                dir: BaseDirectory.AppConfig,\n            }).then((infoStr) => {\n                setTtsPluginInfo(JSON.parse(infoStr));\n            });\n        }\n    }, [ttsServiceList]);\n\n    // handle tts speak\n    const handleSpeak = async () => {\n        const instanceKey = ttsServiceList[0];\n        if (getServiceSouceType(instanceKey) === ServiceSourceType.PLUGIN) {\n            const pluginConfig = serviceInstanceConfigMap[instanceKey];\n            if (!(targetLanguage in ttsPluginInfo.language)) {\n                throw new Error('Language not supported');\n            }\n            let [func, utils] = await invoke_plugin('tts', getServiceName(instanceKey));\n            let data = await func(result, ttsPluginInfo.language[targetLanguage], {\n                config: pluginConfig,\n                utils,\n            });\n            speak(data);\n        } else {\n            if (!(targetLanguage in builtinTtsServices[getServiceName(instanceKey)].Language)) {\n                throw new Error('Language not supported');\n            }\n            const instanceConfig = serviceInstanceConfigMap[instanceKey];\n            let data = await builtinTtsServices[getServiceName(instanceKey)].tts(\n                result,\n                builtinTtsServices[getServiceName(instanceKey)].Language[targetLanguage],\n                {\n                    config: instanceConfig,\n                }","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/pot-app/pot-desktop/blob/594d32ede96acd106b0256deaa8bb440ffcdff40/src/window/Translate/components/TargetArea/index.jsx#L328-L364","documentation":"handleSpeak in TargetArea throws this when the current target language is not a key in the selected TTS plugin's language map (ttsPluginInfo.language). Unlike SourceArea it does not auto-detect; it uses targetLanguage directly, so any translation target the user picked that the plugin doesn't register cannot be spoken aloud.","triggerScenarios":"User clicks speak on the translation result while the first TTS instance in ttsServiceList is a PLUGIN-type service; targetLanguage is not a key of ttsPluginInfo.language.","commonSituations":"Translating into a language the TTS plugin doesn't support (common with niche languages or regional variants); switching target language after configuring TTS; plugin language keys using different codes than the target-language selector.","solutions":["Select a TTS service that supports the chosen target language.","Update or replace the TTS plugin with one that registers the missing language code.","Translate to a supported target language before speaking.","Catch the error and show which languages the plugin supports."],"exampleFix":"// before\nif (!(targetLanguage in ttsPluginInfo.language)) {\n    throw new Error('Language not supported');\n}\n// after\nif (!(targetLanguage in ttsPluginInfo.language)) {\n    toast.error(`TTS plugin cannot speak: ${targetLanguage}`);\n    return;\n}","handlingStrategy":"validation","validationCode":"if (getServiceSouceType(instanceKey) === ServiceSourceType.PLUGIN &&\n    !(targetLanguage in ttsPluginInfo.language)) {\n  // choose another TTS service before speaking\n  return false;\n}\nreturn true;","typeGuard":null,"tryCatchPattern":"try { await handleSpeak(); } catch (e) {\n  if (e.message === 'Language not supported') {\n    toast.error(`TTS plugin cannot speak target language: ${targetLanguage}`);\n  } else throw e;\n}","preventionTips":["Re-validate TTS support whenever targetLanguage changes.","Keep plugin language maps in sync with the app's language code scheme.","Show supported languages in the TTS service configuration UI."],"tags":["tts","plugin","target-language","unsupported-language"],"backgroundTag":"tts-language-not-supported","analyzedSha":"594d32ede96acd106b0256deaa8bb440ffcdff40","analyzedAt":"2026-09-02T18:12:21.811Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}