{"record":{"id":"a582c8bb3bca9a98","repo":"HKUDS/Vibe-Trading","slug":"feishu-qr-login-requires-a-json-agent-config-use","errorCode":null,"errorMessage":"Feishu QR login requires a JSON agent config; use ~/.vibe-trading/agent.json","messagePattern":"Feishu QR login requires a JSON agent config; use ~/\\.vibe-trading/agent\\.json","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/channels/feishu.py","lineNumber":61,"sourceCode":"    app_secret: str,\n    domain: str,\n    *,\n    config_path: Path | None = None,\n) -> Path:\n    \"\"\"Persist Feishu login credentials in the operator JSON config.\n\n    The QR flow creates a bot application and returns its secret only once, so\n    reporting a successful login without durably storing that secret leaves the\n    channel unusable after the CLI process exits.  Write through a private\n    same-directory temporary file and atomically replace the config so readers\n    never observe a partial credential record.\n    \"\"\"\n    from src.config.loader import _read_config_file\n    from src.config.paths import get_config_path\n\n    path = config_path or get_config_path()\n    if path.suffix.lower() != \".json\":\n        raise ValueError(\n            \"Feishu QR login requires a JSON agent config; use \"\n            \"~/.vibe-trading/agent.json\"\n        )\n\n    payload: dict[str, Any] = {}\n    if path.exists():\n        payload = _read_config_file(path)\n    channels = payload.setdefault(\"channels\", {})\n    if not isinstance(channels, dict):\n        raise ValueError(\"agent config 'channels' must be an object\")\n    section = channels.setdefault(\"feishu\", {})\n    if not isinstance(section, dict):\n        raise ValueError(\"agent config 'channels.feishu' must be an object\")\n    section.update(\n        {\n            \"enabled\": True,\n            \"app_id\": app_id,\n            \"app_secret\": app_secret,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/channels/feishu.py#L43-L79","documentation":"Feishu QR login persists credentials by rewriting the agent JSON config, so it refuses non-JSON config files (e.g. agent.toml or agent.yaml) with a ValueError pointing at ~/.vibe-trading/agent.json.","triggerScenarios":"Running Feishu QR login (login command) when get_config_path() resolves to a .toml/.yaml config, or an explicit config_path argument with a non-.json suffix.","commonSituations":"User migrated to TOML config, created agent.toml manually, or set a config env var pointing at a YAML file; the JSON-only constraint is required by the credential writer.","solutions":["Move/create your config at ~/.vibe-trading/agent.json and rerun login","Port existing TOML/YAML settings into the JSON config","Pass config_path explicitly pointing to a .json file if using a custom location"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert Path(config_path).suffix.lower() == '.json', 'Feishu login requires JSON config'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep agent config as agent.json when using Feishu","Check config file extension before starting QR login"],"tags":["config","feishu","file-format","json"],"backgroundTag":"invalid-config-file-format","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}