HKUDS/Vibe-Trading · error · ValueError

connection profile is not eligible for read-only portfolios:

Error message

connection profile is not eligible for read-only portfolios: {profile_id}

What it means

Raised when a stored connection references a profile that either does not exist (profile_by_id returned nothing) or exists but is not marked as eligible for read-only portfolio connections (is_portfolio_connection_profile is false). Only whitelisted read-only-capable profiles may back a local connection.

Source

Thrown at agent/src/trading/connections.py:310

            raw: Decoded registry row.

        Returns:
            The validated connection.

        Raises:
            ValueError: If the row is not an object, carries an invalid id or
                label, names an unknown or ineligible profile, or claims a
                credential reference that does not match its transport.
        """
        if not isinstance(raw, dict):
            raise ValueError("each local connection must be an object")
        connection_id = str(raw.get("id") or "").strip().lower()
        if not _ID_RE.fullmatch(connection_id):
            raise ValueError(f"invalid local connection id: {connection_id or '?'}")
        profile_id = str(raw.get("profile_id") or "").strip().lower()
        profile = profile_by_id(profile_id)
        if not is_portfolio_connection_profile(profile):
            raise ValueError(
                f"connection profile is not eligible for read-only portfolios: {profile_id}"
            )
        label = str(raw.get("label") or profile.label).strip()
        if (
            not label
            or len(label) > 80
            or any(ord(character) < 32 for character in label)
        ):
            raise ValueError(
                "connection label must contain 1 to 80 printable characters"
            )
        expected_ref = _credential_reference(profile.id, connection_id)
        credential_ref = str(raw.get("credential_ref") or expected_ref)
        if (
            credential_ref == CredentialStore.reference(connection_id)
            and profile.transport != "local_plugin"
        ):
            credential_ref = expected_ref

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Check the registered profile list and correct profile_id to a valid, portfolio-eligible profile id
  2. If the profile was renamed in an upgrade, update the settings entry to the new id (or recreate the connection)
  3. Remove the stale connection entry and recreate it via store.create() with a known-good profile
  4. Verify profile_by_id(profile_id) and is_portfolio_connection_profile(...) in a REPL before persisting

Example fix

// before
{"id": "alpaca", "profile_id": "alpaca-pro"}

// after
{"id": "alpaca", "profile_id": "paper"}
Defensive patterns

Strategy: validation

Validate before calling

from trading.profiles import profile_by_id, is_portfolio_connection_profile
profile = profile_by_id(candidate_profile_id)
if not is_portfolio_connection_profile(profile):
    raise ValueError(f"pick a portfolio-eligible profile, not {candidate_profile_id}")

Type guard

def is_portfolio_profile_id(profile_id: str) -> bool:
    return is_portfolio_connection_profile(profile_by_id(profile_id.strip().lower()))

Try / catch

try:
    store.list()
except ValueError as exc:
    if "not eligible" in str(exc):
        # drop or re-point the offending connection entry
        ...

Prevention

When it happens

Trigger: A settings entry with profile_id that is misspelled, refers to a removed/renamed profile, or names a profile type that is not portfolio-eligible (e.g. a write/trading-only connector profile) is parsed by _parse during list() or save().

Common situations: Upgrading the agent after a profile was renamed or removed so old settings files reference dead ids; typos in profile_id; trying to attach a non-read-only connector profile to a local portfolio connection.

Related errors


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