{"record":{"id":"f5e6750d5be7ef7c","repo":"Mintplex-Labs/anything-llm","slug":"tag-tags-i-was-lost-in-translation","errorCode":null,"errorMessage":"  Tag ${tags[i]} was lost in translation","messagePattern":"  Tag (.+?) was lost in translation","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extras/translator/index.mjs","lineNumber":198,"sourceCode":"                stream: false,\n            }),\n        });\n        \n        if(!response.ok) throw new Error(`Failed to translate: ${response.statusText}`);\n        const data = await response.json();\n        let translatedText = this.cleanOutputText(data.message.content);\n        \n        // Restore Trans component tags first (order matters since tags may contain placeholders)\n        if (hasTags) {\n            translatedText = restoreTransTags(translatedText, tags);\n            \n            // Validate all tags were preserved\n            const tagValidation = validateTransTags(text, translatedText);\n            if (!tagValidation.valid) {\n                console.warn(`Warning: Missing Trans tags in translation: ${tagValidation.missing.join(', ')}`);\n                for (let i = 0; i < tags.length; i++) {\n                    if (!translatedText.includes(tags[i])) {\n                        console.warn(`  Tag ${tags[i]} was lost in translation`);\n                    }\n                }\n            }\n        }\n        \n        // Restore original placeholders\n        if (hasPlaceholders) {\n            translatedText = restorePlaceholders(translatedText, placeholders);\n            \n            // Validate all placeholders were preserved\n            const validation = validatePlaceholders(text, translatedText);\n            if (!validation.valid) {\n                console.warn(`Warning: Missing placeholders in translation: ${validation.missing.join(', ')}`);\n                // Attempt to fix by checking if tokens remain untranslated\n                for (let i = 0; i < placeholders.length; i++) {\n                    if (!translatedText.includes(placeholders[i])) {\n                        console.warn(`  Placeholder ${placeholders[i]} was lost in translation`);\n                    }","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/extras/translator/index.mjs#L180-L216","documentation":"Companion diagnostic printed right after the 'Missing Trans tags' summary: the code loops over every original tag captured by extractTransTags() and reports each one whose exact literal form (e.g. '</italic>') is not included in the translated text via String.includes(). It names precisely which markup tokens the LLM lost, so you know what to restore by hand in the generated locale file.","triggerScenarios":"Same translation pipeline as the summary warning — any individual tag whose literal string was dropped, translated, or mangled by the model appears here, one line per lost tag.","commonSituations":"Reviewing batch translation logs to decide which locale keys need manual repair; typically only a few strings lose tags, and this per-tag list maps directly onto the edits needed in the output JSON.","solutions":["Use the printed tag list to patch the named tags back into the generated locale entry (keep the tag order/parity of the source string — every opening tag needs its closing partner).","Re-translate just the affected strings; per-string retries usually recover the token.","If the same tag is lost repeatedly across languages, simplify that source string (fewer tags) or switch translation model.","Sanity-check the fixed entry by diffing tag sets between source and translation before committing."],"exampleFix":"// before: generated locale lost the tags reported by the warning\n// source: \"welcome\": \"Welcome <bold>back</bold>!\"\n\"welcome\": \"Willkommen zurück!\"\n\n// after: restore the reported <bold>/</bold> tags manually\n\"welcome\": \"Willkommen <bold>zurück</bold>!\"","handlingStrategy":"validation","validationCode":"const transTagsOf = (s) => s.match(/<\\/?[a-zA-Z][a-zA-Z0-9]*\\s*\\/?>/g) || [];\n\nfunction reportLostTags(source, translated) {\n  const present = new Set(transTagsOf(translated));\n  return transTagsOf(source).filter(tag => !present.has(tag)); // exactly the per-tag list the warning prints\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat the per-tag warning lines as a work queue: fix the named keys manually instead of re-running the whole batch.","After manual repair, diff source vs translated tag multisets for the edited key to confirm nothing else was lost.","Add a CI check on locale PRs: every tag in a source string must appear (balanced) in each translation."],"tags":["i18n","translation","trans-component","llm","tags"],"backgroundTag":"translation-markup-corruption","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}