{"record":{"id":"fbfd2de826895013","repo":"markedjs/marked","slug":"tokenizer-prop-does-not-exist","errorCode":null,"errorMessage":"tokenizer '${prop}' does not exist","messagePattern":"tokenizer '(.+?)' does not exist","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/Instance.ts","lineNumber":191,"sourceCode":"          const rendererProp = prop as Exclude<keyof _Renderer<ParserOutput, RendererOutput>, 'options' | 'parser'>;\n          const rendererFunc = pack.renderer[rendererProp] as GenericRendererFunction;\n          const prevRenderer = renderer[rendererProp] as GenericRendererFunction;\n          // Replace renderer with func to run extension, but fall back if false\n          renderer[rendererProp] = (...args: unknown[]) => {\n            let ret = rendererFunc.apply(renderer, args);\n            if (ret === false) {\n              ret = prevRenderer.apply(renderer, args);\n            }\n            return (ret || '') as RendererOutput;\n          };\n        }\n        opts.renderer = renderer;\n      }\n      if (pack.tokenizer) {\n        const tokenizer = this.defaults.tokenizer || new _Tokenizer<ParserOutput, RendererOutput>(this.defaults);\n        for (const prop in pack.tokenizer) {\n          if (!(prop in tokenizer)) {\n            throw new Error(`tokenizer '${prop}' does not exist`);\n          }\n          if (['options', 'rules', 'lexer'].includes(prop)) {\n            // ignore options, rules, and lexer properties\n            continue;\n          }\n          const tokenizerProp = prop as Exclude<keyof _Tokenizer<ParserOutput, RendererOutput>, 'options' | 'rules' | 'lexer'>;\n          const tokenizerFunc = pack.tokenizer[tokenizerProp] as UnknownFunction;\n          const prevTokenizer = tokenizer[tokenizerProp] as UnknownFunction;\n          // Replace tokenizer with func to run extension, but fall back if false\n          // @ts-expect-error cannot type tokenizer function dynamically\n          tokenizer[tokenizerProp] = (...args: unknown[]) => {\n            let ret = tokenizerFunc.apply(tokenizer, args);\n            if (ret === false) {\n              ret = prevTokenizer.apply(tokenizer, args);\n            }\n            return ret;\n          };\n        }","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/markedjs/marked/blob/9552b6bbca7f587f96b7249c5833358a17a18e2b/src/Instance.ts#L173-L209","documentation":"Thrown by Marked.use() when the tokenizer object you pass contains a key that is not a method or known property of the _Tokenizer class. Marked iterates the keys with for...in and rejects any prop where !(prop in tokenizer) (Instance.ts:189-191). Allowed keys are the public tokenizer methods (e.g. space, code, fences, heading, hr, blockquote, list, html, def, table, lheading, paragraph, text, escape, tag, link, reflink, emStrong, codespan, br, del, autolink, url, inlineText) plus the ignored options, rules, and lexer. To tokenize NEW syntax use extensions:[{ name, level, tokenizer }] instead of overriding the tokenizer object.","triggerScenarios":"marked.use({ tokenizer:{ inlineTexts(src){...} } }) with a typo such as 'inlineTexts' or 'Heading'; overriding a method renamed across marked majors; attaching a helper property to the tokenizer override object; copying a custom-tokenizer snippet intended for extensions into the tokenizer override.","commonSituations":"Upgrading marked across a major version where tokenizer method names changed; misspelling lowercased concatenated names (inlineText, emStrong); mixing up the two extension mechanisms (override vs addon).","solutions":["Rename the key to a real tokenizer method (see allowed list); check exact casing.","For brand-new syntax, move it to extensions:[{ name, level, tokenizer(src){...} }].","Strip helper/utility fields from the tokenizer override object."],"exampleFix":"// before — 'inlineTexts' is not a tokenizer method\nmarked.use({ tokenizer: { inlineTexts(src) { /* ... */ } } });\n\n// after\nmarked.use({ tokenizer: { inlineText(src) { /* ... */ } } });","handlingStrategy":"validation","validationCode":"import { _Tokenizer } from 'marked';\nconst ALLOWED = Object.getOwnPropertyNames(_Tokenizer.prototype)\n  .filter(k => !['constructor','options','rules','lexer'].includes(k));\nfor (const prop in myExt.tokenizer ?? {}) {\n  if (!ALLOWED.includes(prop)) {\n    throw new Error('tokenizer key \"' + prop + '\" is not a known tokenizer method');\n  }\n}\nmarked.use(myExt);","typeGuard":"function isValidTokenizerKey(prop, tokenizerProto) {\n  return prop in tokenizerProto && !['constructor','options','rules','lexer'].includes(prop);\n}","tryCatchPattern":null,"preventionTips":["Use the TokenizerObject type so TS constrains the keys.","Confirm method names against the Tokenizer API docs for your marked version.","Prefer extensions: for new syntax; reserve tokenizer: overrides for changing built-in behaviour."],"tags":["configuration","tokenizer","typo","validation","marked-use"],"backgroundTag":null,"analyzedSha":"9552b6bbca7f587f96b7249c5833358a17a18e2b","analyzedAt":"2026-08-13T04:27:55.513Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}