can1357/oh-my-pi · error · ValueError

no GitHub access configured: set GITHUB_TOKEN, or set ROBOMP

Error message

no GitHub access configured: set GITHUB_TOKEN, or set ROBOMP_GH_PROXY_URL + ROBOMP_GH_PROXY_HMAC_KEY to use gh-proxy.

What it means

As the final check in _validate_proxy_or_pat(), if neither a direct PAT (GITHUB_TOKEN) nor the gh-proxy pair (ROBOMP_GH_PROXY_URL + ROBOMP_GH_PROXY_HMAC_KEY) is configured, Settings validation fails: there would be no way to authenticate any GitHub request.

Source

Thrown at python/robomp/src/config.py:251

          the isolation goal).
        - Proxy URL set but no HMAC key (or vice versa) → reject (gh-proxy
          would either be unauthenticated or unreachable).
        - Neither set → also reject; SOMETHING needs to talk to GitHub.
        """
        has_token = self.github_token is not None
        has_url = bool(self.gh_proxy_url)
        has_key = self.gh_proxy_hmac_key is not None
        if has_token and has_url:
            raise ValueError(
                "GITHUB_TOKEN and ROBOMP_GH_PROXY_URL are mutually exclusive — "
                "set ONE to choose between direct-PAT and gh-proxy modes."
            )
        if has_url != has_key:
            raise ValueError(
                "ROBOMP_GH_PROXY_URL and ROBOMP_GH_PROXY_HMAC_KEY must both be set together (or both empty)."
            )
        if not has_token and not has_url:
            raise ValueError(
                "no GitHub access configured: set GITHUB_TOKEN, or set "
                "ROBOMP_GH_PROXY_URL + ROBOMP_GH_PROXY_HMAC_KEY to use gh-proxy."
            )
        return self

    @field_validator("repo_allowlist_raw", mode="before")
    @classmethod
    def _coerce_allowlist(cls, v: object) -> str:
        if v is None:
            return ""
        if isinstance(v, str):
            return v
        if isinstance(v, (list, tuple)):
            return ",".join(str(item) for item in v)
        return str(v)

    @property
    def repo_allowlist(self) -> frozenset[str]:

View on GitHub (pinned to 9690622007)

Solutions

  1. Set GITHUB_TOKEN for direct-PAT mode, or both ROBOMP_GH_PROXY_URL and ROBOMP_GH_PROXY_HMAC_KEY for proxy mode.
  2. Confirm the .env file exists and is actually loaded (correct path / dotenv loading).
  3. In containerized deployments, verify secrets are injected into the orchestrator container.
  4. Double-check variable names against the documentation (exact spelling).

Example fix

// before (empty env)
# no GitHub-related variables
// after (proxy mode)
ROBOMP_GH_PROXY_URL=http://gh-proxy:8080
ROBOMP_GH_PROXY_HMAC_KEY=<key>
Defensive patterns

Strategy: validation

Validate before calling

import os
if not os.environ.get("GITHUB_TOKEN") and not (os.environ.get("ROBOMP_GH_PROXY_URL") and os.environ.get("ROBOMP_GH_PROXY_HMAC_KEY")):
    raise SystemExit("no GitHub access configured: set GITHUB_TOKEN, or the gh-proxy URL+HMAC pair")

Type guard

def github_access_configured(env: dict) -> bool:
    return bool(env.get("GITHUB_TOKEN")) or (bool(env.get("ROBOMP_GH_PROXY_URL")) and bool(env.get("ROBOMP_GH_PROXY_HMAC_KEY")))

Try / catch

try:
    cfg = Settings(_env_file=".env")
except ValidationError as exc:
    sys.exit(f"configuration error: {exc}")

Prevention

When it happens

Trigger: Constructing Settings with github_token None, gh_proxy_url empty, and gh_proxy_hmac_key None — e.g. running the CLI in a fresh environment with no robomp env vars at all.

Common situations: First-time setup without the quickstart .env; .env file not loaded (wrong working directory, dotenv not enabled); CI job missing secrets; variables defined under different names than documented.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/51051f27188ddb33. Report an issue: GitHub.