HKUDS/Vibe-Trading · error · ValueError

Feishu QR login requires a JSON agent config; use ~/.vibe-tr

Error message

Feishu QR login requires a JSON agent config; use ~/.vibe-trading/agent.json

What it means

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.

Source

Thrown at agent/src/channels/feishu.py:61

    app_secret: str,
    domain: str,
    *,
    config_path: Path | None = None,
) -> Path:
    """Persist Feishu login credentials in the operator JSON config.

    The QR flow creates a bot application and returns its secret only once, so
    reporting a successful login without durably storing that secret leaves the
    channel unusable after the CLI process exits.  Write through a private
    same-directory temporary file and atomically replace the config so readers
    never observe a partial credential record.
    """
    from src.config.loader import _read_config_file
    from src.config.paths import get_config_path

    path = config_path or get_config_path()
    if path.suffix.lower() != ".json":
        raise ValueError(
            "Feishu QR login requires a JSON agent config; use "
            "~/.vibe-trading/agent.json"
        )

    payload: dict[str, Any] = {}
    if path.exists():
        payload = _read_config_file(path)
    channels = payload.setdefault("channels", {})
    if not isinstance(channels, dict):
        raise ValueError("agent config 'channels' must be an object")
    section = channels.setdefault("feishu", {})
    if not isinstance(section, dict):
        raise ValueError("agent config 'channels.feishu' must be an object")
    section.update(
        {
            "enabled": True,
            "app_id": app_id,
            "app_secret": app_secret,

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Move/create your config at ~/.vibe-trading/agent.json and rerun login
  2. Port existing TOML/YAML settings into the JSON config
  3. Pass config_path explicitly pointing to a .json file if using a custom location
Defensive patterns

Strategy: validation

Validate before calling

assert Path(config_path).suffix.lower() == '.json', 'Feishu login requires JSON config'

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/a582c8bb3bca9a98. Report an issue: GitHub.