{"record":{"id":"66b74779475d3809","repo":"remotion-dev/remotion","slug":"could-not-find-an-include-with-the-key-key","errorCode":null,"errorMessage":"Could not find an include with the key: '${key}'.\nThere is: ${Array.from(_map.keys())}.","messagePattern":"Could not find an include with the key: '(.+?)'\\.\nThere is: (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-plugin/src/includes.ts","lineNumber":47,"sourceCode":"\n\t// const toReplace: [index:number, length: number, str: string][] = []\n\tconst toReplace = [];\n\n\tlet match;\n\twhile ((match = includes.exec(code)) !== null) {\n\t\t// This is necessary to avoid infinite loops with zero-width matches\n\t\tif (match.index === includes.lastIndex) {\n\t\t\tincludes.lastIndex++;\n\t\t}\n\n\t\tconst key = match[1];\n\t\tconst replaceWith = _map.get(key);\n\n\t\tif (!replaceWith) {\n\t\t\tconst msg = `Could not find an include with the key: '${key}'.\\nThere is: ${Array.from(\n\t\t\t\t_map.keys(),\n\t\t\t)}.`;\n\t\t\tthrow new Error(msg);\n\t\t}\n\n\t\ttoReplace.push([match.index, match[0].length, replaceWith]);\n\t}\n\n\tlet newCode = code.toString();\n\t// Go backwards through the found changes so that we can retain index position\n\ttoReplace.reverse().forEach((r) => {\n\t\tnewCode =\n\t\t\tnewCode.substring(0, Number(r[0])) +\n\t\t\tr[2] +\n\t\t\tnewCode.substring(Number(r[0]) + Number(r[1]));\n\t});\n\treturn newCode;\n};\n","sourceCodeStart":29,"sourceCodeEnd":63,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/docusaurus-plugin/src/includes.ts#L29-L63","documentation":"Thrown by `replaceIncludesInCode` in the docusaurus-plugin when a `// @include: someKey` marker in a docs code block references a key that is not present in the includes Map. The error lists the available keys so the author can correct the reference. Includes are registered earlier via `addIncludes` from twoslash or fenced blocks named with `// - name` pragmas.","triggerScenarios":"A docs MDX/Markdown code block contains `// @include: foo` but no include named `foo` (or `parentName-foo`) was registered. Typo in the key, a renamed include, or an include defined in a different file that was not added to the shared map.","commonSituations":"Renaming an include pragma without updating references; referencing an include from a file that is processed later or not at all; copy-pasting an include marker from another doc.","solutions":["Check the available keys printed in the error and fix the typo to match an existing include name.","Ensure the include is defined with a `twoslash include [name]` pragma or `// - subkey` marker in a code block processed before the reference.","Re-run the docs build to confirm the key resolves."],"exampleFix":"// before\n// @include: mispelled-name\n\n// after (match the registered pragma)\n// @include: correct-name","handlingStrategy":"validation","validationCode":"const key = 'myInclude';\nif (!includeMap.has(key)) {\n  throw new Error(`include '${key}' missing; available: ${[...includeMap.keys()]}`);\n}","typeGuard":"const includeExists = (map: Map<string, string>, key: string): boolean =>\n  map.has(key);","tryCatchPattern":null,"preventionTips":["Keep include names in sync across docs — rename references when renaming pragmas.","Define includes in files processed before they are referenced.","Use the available-keys list in the error to spot typos."],"tags":["docusaurus","docs","includes","twoslash"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}