{"record":{"id":"9cc3b5dbf5c1b4ee","repo":"remotion-dev/remotion","slug":"a-twoslash-code-block-needs-a-pragma-like-twoslas","errorCode":null,"errorMessage":"A twoslash code block needs a pragma like 'twoslash include [name]'","messagePattern":"A twoslash code block needs a pragma like 'twoslash include \\[name\\]'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin/src/shiki.ts","lineNumber":141,"sourceCode":"\t\t}\n\n\t\t// Do nothing if the node has an attribute to ignore\n\t\tif (\n\t\t\tObject.keys(fence.meta).filter((key) =>\n\t\t\t\t(twoslashSettings.ignoreCodeblocksWithCodefenceMeta || []).includes(\n\t\t\t\t\tkey,\n\t\t\t\t),\n\t\t\t).length > 0\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet shikiHTML: string;\n\n\t\tif (fence.lang === 'twoslash') {\n\t\t\t// Support 'twoslash' includes\n\t\t\tif (!fence.meta.include || typeof fence.meta.include !== 'string') {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"A twoslash code block needs a pragma like 'twoslash include [name]'\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\taddIncludes(includes, fence.meta.include, node.value);\n\t\t\tshikiHTML = twoslashSettings.wrapFragments\n\t\t\t\t? `<div class=\"shiki-twoslash-fragment\"></div>`\n\t\t\t\t: '';\n\t\t} else if (fence.meta.twoslash && isTwoslashEnabled()) {\n\t\t\t// Twoslash code block — use cached call\n\t\t\tconst importedCode = replaceIncludesInCode(includes, node.value);\n\t\t\ttry {\n\t\t\t\tshikiHTML = cachedTwoslashCall(importedCode, fence.lang, highlighter);\n\t\t\t} catch (error) {\n\t\t\t\tconst shouldAlwaysRaise =\n\t\t\t\t\tprocess && process.env && Boolean(process.env.CI);\n\n\t\t\t\tif (","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/docusaurus-plugin/src/shiki.ts#L123-L159","documentation":"Thrown during Shiki/twoslash processing in the docusaurus-plugin when a fenced code block uses the `twoslash` language but has no `include` meta pragma (e.g. `twoslash include [name]`). A bare ```twoslash fence is only valid when it declares an include name under which its source is registered; otherwise the processor does not know how to handle it.","triggerScenarios":"Writing a Markdown fence ` ```twoslash ` without a matching `twoslash include someName` meta string. The check `fence.meta.include` is falsy or not a string, so the error fires.","commonSituations":"Authoring a docs code sample and forgetting the include pragma; copy-pasting a twoslash fence from a tool that stripped the meta; mis-typing the meta as `includes` or `name`.","solutions":["Add the include pragma to the fence info string: ` ```twoslash include mySnippet `.","If you did not mean to declare an include, use a normal ` ```ts ` fence with optional `twoslash` meta instead.","Verify the fence info string is parsed correctly (no stray characters)."],"exampleFix":"```twoslash\n// before (throws)\n```\n\n```twoslash include mySnippet\n// after\n```","handlingStrategy":"validation","validationCode":"const fenceHasInclude = (meta: {include?: unknown}): boolean =>\n  typeof meta.include === 'string' && meta.include.length > 0;","typeGuard":"const isValidTwoslashFence = (fence: {lang: string; meta: {include?: unknown}}): boolean =>\n  fence.lang === 'twoslash' && typeof fence.meta.include === 'string';","tryCatchPattern":null,"preventionTips":["Always add `include [name]` to a ```twoslash fence.","Use ```ts with a `twoslash` meta for plain twoslash samples instead.","Lint fenced code blocks in CI to enforce the include pragma."],"tags":["docusaurus","docs","twoslash","shiki","fenced-code"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}