github/copilot-sdk · error · ValueError

telemetry is not supported with…

Error message

telemetry is not supported with RuntimeConnection.for_inprocess(): telemetry configuration is lowered to environment variables read by native runtime code running in the shared host process, so per-client telemetry cannot be honored in-process. Configure telemetry via the host process environment, or use a child-process transport.

What it means

Telemetry settings are lowered to environment variables consumed by native runtime code; in the in-process transport that code runs in the shared host process, so per-client telemetry cannot be honored. Passing options.telemetry with an in-process connection raises ValueError.

Solutions

  1. Configure telemetry via the host process environment variables and remove options.telemetry
  2. Use a child-process transport (for_stdio) if programmatic per-client telemetry is needed

Example fix

// before
client = CopilotClient(connection=RuntimeConnection.for_inprocess(), telemetry={"enabled": False})
// after
os.environ["COPILOT_TELEMETRY_ENABLED"] = "0"
client = CopilotClient(connection=RuntimeConnection.for_inprocess())
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(conn, InProcessRuntimeConnection) and opts.telemetry is not None:
    raise ValueError("telemetry is unsupported for in-process; use host env")

Type guard

def supports_client_telemetry(conn) -> bool:
    return not isinstance(conn, InProcessRuntimeConnection)

Try / catch

try:
    client = CopilotClient(connection=conn, telemetry=tel)
except ValueError as e:
    if "telemetry is not supported" in str(e):
        os.environ.update(telemetry_to_env(tel)); tel = None
        client = CopilotClient(connection=conn)

Prevention

When it happens

Trigger: Creating CopilotClient with RuntimeConnection.for_inprocess() and a non-None telemetry option in _CopilotClientOptions.

Common situations: Enabling/disabling telemetry programmatically after migrating from stdio transport to in-process; shared telemetry config in a wrapper library that always sets telemetry.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/5708a67ae00676cd. Report an issue: GitHub.

Appendix: source

Thrown at python/copilot/client.py:1497

) -> None:
    """Validate env/telemetry/working-directory options against the transport.

    Per-client environment is only representable for child-process transports
    (each client owns its own OS process). The in-process (FFI) transport loads
    the native runtime into the shared host process, whose single environment
    block and process-global working directory cannot carry per-client values,
    so options that lower to them are rejected there (fail loud, not silent).
    """
    if isinstance(connection, InProcessRuntimeConnection):
        if options.env is not None:
            raise ValueError(
                "env is not supported with RuntimeConnection.for_inprocess(): the "
                "in-process transport loads the native runtime into the shared host "
                "process, whose single environment block cannot carry per-client "
                "values. Set the variables on the host process environment instead."
            )
        if options.telemetry is not None:
            raise ValueError(
                "telemetry is not supported with RuntimeConnection.for_inprocess(): "
                "telemetry configuration is lowered to environment variables read by "
                "native runtime code running in the shared host process, so per-client "
                "telemetry cannot be honored in-process. Configure telemetry via the "
                "host process environment, or use a child-process transport."
            )
        if options.working_directory is not None:
            raise ValueError(
                "working_directory is not supported with RuntimeConnection.for_inprocess(): "
                "the native runtime shares the host process working directory, so a "
                "per-client working directory cannot be honored in-process. Use a "
                "child-process "
                "transport, or set the process working directory before creating the client."
            )
        return

    if (
        isinstance(connection, ChildProcessRuntimeConnection)

View on GitHub (pinned to cd8cf15dc3)