{"record":{"id":"0fbe3d37cba16d25","repo":"ZhuLinsen/daily_stock_analysis","slug":"could-not-find-managed-table-markers-table-start","errorCode":null,"errorMessage":"Could not find managed table markers {TABLE_START!r} and {TABLE_END!r}","messagePattern":"Could not find managed table markers (.+?) and (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/generate_notification_actions_env_table.py","lineNumber":166,"sourceCode":"                    _markdown_cell(channels),\n                    _markdown_cell(row.source),\n                    _markdown_cell(row.default),\n                )\n            )\n            + \" |\"\n        )\n    return \"\\n\".join(lines)\n\n\ndef normalize_markdown_block(content: str) -> str:\n    return \"\\n\".join(line.rstrip() for line in content.strip().splitlines())\n\n\ndef extract_managed_block(markdown: str) -> str:\n    start = markdown.find(TABLE_START)\n    end = markdown.find(TABLE_END)\n    if start == -1 or end == -1 or end < start:\n        raise ValueError(\n            f\"Could not find managed table markers {TABLE_START!r} and {TABLE_END!r}\"\n        )\n    table_start = start + len(TABLE_START)\n    return markdown[table_start:end].strip()\n\n\ndef replace_managed_block(markdown: str, table: str) -> str:\n    start = markdown.find(TABLE_START)\n    end = markdown.find(TABLE_END)\n    if start == -1 or end == -1 or end < start:\n        raise ValueError(\n            f\"Could not find managed table markers {TABLE_START!r} and {TABLE_END!r}\"\n        )\n    before = markdown[: start + len(TABLE_START)]\n    after = markdown[end:]\n    return f\"{before}\\n\\n{table}\\n\\n{after.lstrip()}\"\n\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/scripts/generate_notification_actions_env_table.py#L148-L184","documentation":"extract_managed_block scans a markdown doc for the managed-region markers '<!-- notification-actions-env-table:start -->' (TABLE_START) and its end counterpart; if either is missing or the end marker appears before the start marker, it raises. The markers delimit the auto-generated env table inside the notification docs so regeneration can replace only that block.","triggerScenarios":"The target markdown doc lost its marker comments — manual editing removed them, a formatter stripped HTML comments, the doc was rewritten from an old template, or the end marker was accidentally deleted leaving an unterminated block.","commonSituations":"Someone edits docs/*.md by hand and deletes the invisible HTML comments; a markdown formatter/linter purges comments; docs file replaced during a merge conflict resolution.","solutions":["Restore both markers in the target doc, exactly as defined in scripts/generate_notification_actions_env_table.py:30-32 (start and end comments on their own lines).","Keep any hand-written content outside the markers — everything between them is overwritten by generation.","After restoring, run the script to verify extraction and regeneration succeed.","If the doc was intentionally restructured, move the markers to the new location instead of deleting them."],"exampleFix":"# before (docs/...md)\n## Actions 环境变量\n| key | ... |   <!-- markers deleted by hand -->\n\n# after\n## Actions 环境变量\n<!-- notification-actions-env-table:start -->\n<!-- notification-actions-env-table:end -->","handlingStrategy":"validation","validationCode":"from scripts.generate_notification_actions_env_table import TABLE_START, TABLE_END\n\nmd = Path(doc_path).read_text()\nassert TABLE_START in md and TABLE_END in md and md.index(TABLE_END) > md.index(TABLE_START), \"managed markers missing/out of order\"","typeGuard":"def has_managed_block(markdown: str) -> bool:\n    s, e = markdown.find(TABLE_START), markdown.find(TABLE_END)\n    return s != -1 and e != -1 and e > s","tryCatchPattern":null,"preventionTips":["Never delete the HTML-comment markers when editing generated docs.","Keep hand edits outside the managed block; generation overwrites inside it.","Configure markdown linters/formatters to preserve HTML comments."],"tags":["docs","markers","generation","maintenance"],"backgroundTag":null,"analyzedSha":"5159bd72e8373d215492dff122acc9d389e219c9","analyzedAt":"2026-08-15T01:59:36.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}