{"record":{"id":"c3dbb5422ce90091","repo":"yamadashy/repomix","slug":"unsupported-output-style-for-handlebars-template","errorCode":null,"errorMessage":"Unsupported output style for handlebars template: ${style}","messagePattern":"Unsupported output style for handlebars template: (.+?)","errorType":"exception","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/core/output/outputGenerate.ts","lineNumber":47,"sourceCode":"const getCompiledTemplate = (style: string): Handlebars.TemplateDelegate => {\n  const cached = compiledTemplateCache.get(style);\n  if (cached) {\n    return cached;\n  }\n\n  let template: string;\n  switch (style) {\n    case 'xml':\n      template = getXmlTemplate();\n      break;\n    case 'markdown':\n      template = getMarkdownTemplate();\n      break;\n    case 'plain':\n      template = getPlainTemplate();\n      break;\n    default:\n      throw new RepomixError(`Unsupported output style for handlebars template: ${style}`);\n  }\n\n  const compiled = Handlebars.compile(template);\n  compiledTemplateCache.set(style, compiled);\n  return compiled;\n};\n\n// The Markdown template wraps file contents, the directory structure, and git\n// diffs in the same code fence, so the delimiter has to be longer than the\n// longest backtick run across all of them. A diff of a Markdown file, for\n// example, carries bare ``` context lines that would otherwise close the fence\n// early and corrupt the output.\nconst calculateMarkdownDelimiter = (contents: ReadonlyArray<string | undefined>): string => {\n  const maxBackticks = contents\n    .flatMap((content) => content?.match(/`+/g) ?? [])\n    .reduce((max, match) => Math.max(max, match.length), 0);\n  return '`'.repeat(Math.max(3, maxBackticks + 1));\n};","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/output/outputGenerate.ts#L29-L65","documentation":"getCompiledTemplate selects a Handlebars template based on the requested output style. Only markdown and plain are supported for Handlebars rendering; any other style string reaching this function has no template, so it throws a RepomixError immediately.","triggerScenarios":"getCompiledTemplate(style) is called with a style other than 'markdown' or 'plain' — e.g. 'xml', 'json', or an arbitrary string from config.output.style routed into generateHandlebarOutput.","commonSituations":"Programmatic use of the output generator API with a raw style string; a config file with a misspelled style ('markdwon'); custom tooling that bypasses generateOutput's switch dispatch.","solutions":["Use style 'markdown' or 'plain' when rendering via the Handlebars path.","Render 'xml'/'json' styles through generateParsableXmlOutput/generateParsableJsonOutput instead.","Validate config.output.style against the allowed set before calling the generator.","Fix typos in the config file's output.style value."],"exampleFix":"// before\nawait generateHandlebarOutput({...config, output: {...config.output, style: 'xml'}}, ctx, files);\n// after\nawait generateParsableXmlOutput(ctx); // or style: 'markdown'","handlingStrategy":"validation","validationCode":"const HANDLEBAR_STYLES = ['markdown', 'plain'] as const;\nif (!HANDLEBAR_STYLES.includes(style as never)) {\n  throw new Error(`Handlebars path supports only ${HANDLEBAR_STYLES.join('/')}, got ${style}`);\n}","typeGuard":"const isHandlebarStyle = (s: string): s is 'markdown' | 'plain' =>\n  s === 'markdown' || s === 'plain';","tryCatchPattern":"try {\n  const output = await generateOutput(config, ctx);\n} catch (e) {\n  if (e instanceof RepomixError && e.message.startsWith('Unsupported output style for handlebars')) {\n    // route xml/json to the parsable generators or correct the style\n  }\n}","preventionTips":["Only call the Handlebars generator for markdown/plain styles.","Centralize style constants instead of raw strings in code.","Schema-validate config.output.style at load time.","Watch for typos like 'markdwon' in config files."],"tags":["output","template","configuration","handlebars"],"backgroundTag":"unsupported-output-style","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}