{"record":{"id":"bd7e9b6205b61b81","repo":"bmad-code-org/BMAD-METHOD","slug":"unsupported-render-token-token","errorCode":null,"errorMessage":"unsupported render token: {token}","messagePattern":"unsupported render token: (.+?)","errorType":"exception","errorClass":"RenderError","httpStatus":null,"severity":"error","filePath":"src/scripts/render_skill.py","lineNumber":257,"sourceCode":"        token: value.replace(\"{skill-root}\", str(destination))\n        if token.startswith(\"{workflow.\")\n        else value\n        for token, value in replacements.items()\n    }\n    source_names = set(sources)\n    patterns = [\n        *(re.escape(token) for token in sorted(replacements, key=len, reverse=True)),\n        _SNAPSHOT_TOKEN.pattern,\n    ]\n    token_pattern = re.compile(\"|\".join(patterns))\n\n    def replace(match: re.Match[str]) -> str:\n        token = match.group(0)\n        if token in replacements:\n            return replacements[token]\n        snapshot = _SNAPSHOT_TOKEN.fullmatch(token)\n        if snapshot is None:\n            raise RenderError(f\"unsupported render token: {token}\")\n        target = snapshot.group(1)\n        if target not in source_names:\n            raise RenderError(f\"snapshot reference targets undeclared source: {target}\")\n        return str(destination / target)\n\n    rendered: dict[str, str] = {}\n    for name, content in sources.items():\n        # Inserted paths and customization prose are never scanned as source tokens.\n        rendered[name] = token_pattern.sub(replace, content)\n    return rendered\n\n\ndef _verify_existing(destination: Path, manifest: dict[str, Any]) -> None:\n    manifest_path = destination / \"manifest.json\"\n    try:\n        existing = json.loads(manifest_path.read_text(encoding=\"utf-8\"))\n    except (OSError, UnicodeError, json.JSONDecodeError) as error:\n        raise RenderError(f\"corrupt existing generation {destination}: {error}\") from error","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/bmad-code-org/BMAD-METHOD/blob/b70486b9bdcb0a404d329e2a763b57964e7f1360/src/scripts/render_skill.py#L239-L275","documentation":"Defensive invariant inside _render_sources.replace. The combined regex is assembled from the known replacement tokens plus the snapshot pattern, so any match should be either a known replacement or a snapshot reference. If a matched token is somehow neither, this fires. Not reachable under correct pattern construction; it indicates a bug in pattern assembly or tampering with the replacements dict.","triggerScenarios":"Effectively unreachable through normal use. Could only surface if the replacements dict is mutated to non-string keys/values between pattern build and substitution, or via a regex construction edge case.","commonSituations":"Internal regression after monkey-patching renderer internals; corrupted in-memory state.","solutions":["Do not modify or monkey-patch renderer internals.","Upgrade to a released version of the renderer.","Report a bug including the exact offending token string from the message."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from render_skill import render, RenderError\n\ntry:\n    entry = render(project_root, skill_dir)\nexcept RenderError as e:\n    if \"unsupported render token\" in str(e):\n        # internal invariant -- report and upgrade/file a bug\n        ...\n    raise","preventionTips":["Do not monkey-patch renderer internals or mutate the replacements dict.","Run a released version of render_skill.py.","If this fires, treat it as a renderer bug and report the token string."],"tags":["python","rendering","internal-api","invariant","regex"],"backgroundTag":null,"analyzedSha":"b70486b9bdcb0a404d329e2a763b57964e7f1360","analyzedAt":"2026-08-13T01:21:12.247Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}