{"record":{"id":"9cde6231de752b82","repo":"sansan0/TrendRadar","slug":"transport","errorCode":null,"errorMessage":"不支持的传输模式: {transport}","messagePattern":"不支持的传输模式: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mcp_server/server.py","lineNumber":1215,"sourceCode":"    print(\"    24. get_channel_format_guide  - 获取渠道格式化策略指南（提示词）\")\n    print(\"    25. get_notification_channels - 获取已配置的通知渠道状态\")\n    print(\"    26. send_notification         - 向通知渠道发送消息（自动适配格式）\")\n    print(\"=\" * 60)\n    print()\n\n    # 根据传输模式运行服务器\n    if transport == 'stdio':\n        mcp.run(transport='stdio')\n    elif transport == 'http':\n        # HTTP 模式（生产推荐）\n        mcp.run(\n            transport='http',\n            host=host,\n            port=port,\n            path='/mcp'  # HTTP 端点路径\n        )\n    else:\n        raise ValueError(f\"不支持的传输模式: {transport}\")\n\n\nif __name__ == '__main__':\n    import argparse\n\n    parser = argparse.ArgumentParser(\n        description='TrendRadar MCP Server - 新闻热点聚合 MCP 工具服务器',\n        formatter_class=argparse.RawDescriptionHelpFormatter,\n        epilog=\"\"\"\n详细配置教程请查看: README-Cherry-Studio.md\n        \"\"\"\n    )\n    parser.add_argument(\n        '--transport',\n        choices=['stdio', 'http'],\n        default='stdio',\n        help='传输模式：stdio (默认) 或 http (生产环境)'\n    )","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/sansan0/TrendRadar/blob/8ee26026ba6c11dec41a95fb3895a7162876caa1/mcp_server/server.py#L1197-L1233","documentation":"Raised by Scheduler._validate_hhmm when a time string does not match the strict two-digit 'HH:MM' pattern (regex ^\\d{2}:\\d{2}$). The scheduler config expects times like '09:30', not '9:30', '0930', '9:30:00', or '09-30'. This is a ValueError thrown during config validation before any scheduling starts.","triggerScenarios":"Passing a time window string to scheduler config (e.g. quiet_hours or scheduled push windows) that is not exactly 5 characters 'NN:NN'. Examples producing it: '9:00' (missing leading zero), '09:00:00' (seconds included), '0900' (no colon), '09:3O' (letter O), or a full ISO datetime '2024-01-01T09:00'.","commonSituations":"Hand-edited YAML/JSON config files with times typed without zero-padding; times copied from ISO 8601 timestamps; environment variables overriding defaults with a differently formatted time; UI or script generating times via str(int(hour)) which drops the leading zero.","solutions":["Fix the offending value to zero-padded HH:MM, e.g. '9:30' -> '09:30'.","If the value comes from a script, format it with f'{h:02d}:{m:02d}' or datetime.strptime(...).strftime('%H:%M') before passing it to the scheduler.","Add a config-schema check (e.g. pydantic validator or JSON Schema pattern '^([01]\\d|2[0-3]):[0-5]\\d$') so mistakes are caught at config load with a clearer message.","Audit all time fields in the config file, since one bad field usually means siblings may share the same formatting mistake."],"exampleFix":"# before\nquiet_hours = {\"start\": \"9:00\", \"end\": \"23:00\"}\n\n# after\nquiet_hours = {\"start\": \"09:00\", \"end\": \"23:00\"}\n\n# or generate safely\nstart = f\"{9:02d}:00\"  # '09:00'","handlingStrategy":"validation","validationCode":"import re\n\nHHMM_RE = re.compile(r\"^\\d{2}:\\d{2}$\")\n\ndef is_hhmm_shape(value: str) -> bool:\n    return bool(HHMM_RE.match(value))\n\n# before loading scheduler config\nfor name, t in config_times.items():\n    if not is_hhmm_shape(t):\n        raise ConfigError(f\"{name}='{t}' must be HH:MM, e.g. '09:30'\")","typeGuard":"def is_hhmm(value: str) -> bool:\n    \"\"\"True only for strings like '09:30' (shape checked; range see is_valid_hhmm).\"\"\"\n    return isinstance(value, str) and bool(re.match(r\"^\\d{2}:\\d{2}$\", value))","tryCatchPattern":null,"preventionTips":["Always format times with strftime('%H:%M') or f'{h:02d}:{m:02d}' instead of string concatenation.","Add a regex pattern to your config schema so mistakes fail at load time with a field name.","Add unit tests over representative boundary values ('00:00', '23:59', '9:30', '24:00') when touching scheduler config code."],"tags":["scheduler","validation","time-format","config"],"backgroundTag":null,"analyzedSha":"8ee26026ba6c11dec41a95fb3895a7162876caa1","analyzedAt":"2026-08-15T01:42:18.084Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}