github/copilot-sdk · error
telemetry is not supported with…
Error message
telemetry is not supported with RuntimeConnection.forInProcess(): 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
CopilotClient.resume_session() validates that on_permission_request, when provided, is callable, raising this ValueError otherwise. This callback is invoked when the resumed session requests a permission decision, so a non-callable value would break the permission flow at runtime.
Solutions
- Pass a callable, e.g. on_permission_request=PermissionHandler.approve_all or a plain function/lambda.
- If no permission handling is needed, omit the argument entirely (leave the default None).
- If loading from config, map config keys back to real callables before the call.
- Verify with callable() or an assert before calling resume_session.
Example fix
// before
await client.resume_session("session-123", on_permission_request="approve_all")
// after
await client.resume_session("session-123", on_permission_request=lambda req: req.approve()) Defensive patterns
Strategy: validation
Validate before calling
if on_permission_request is not None and not callable(on_permission_request):
raise TypeError("on_permission_request must be callable") Type guard
def is_permission_handler(cb) -> bool:
return cb is None or callable(cb) Try / catch
try:
await client.resume_session("session-123", on_permission_request=cb)
except ValueError as e:
if "must be callable" in str(e):
await client.resume_session("session-123") # omit broken callback Prevention
- Pass methods, not classes: PermissionHandler.approve_all, not PermissionHandler.
- Don't route callbacks through JSON/config without converting back to callables.
- Type-hint the callback as Callable[..., Any] in your wrappers.
When it happens
Trigger: Calling resume_session(session_id, on_permission_request=...) with a string, a handler class instead of a bound method (PermissionHandler vs PermissionHandler.handle), or an accidentally shadowed non-callable variable.
Common situations: Passing a class instead of an instance method; config-driven callbacks deserialized from JSON where functions became strings; a typo where the variable holds data instead of the function.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- on_permission_request must be callable when provided.
- Invalid entry '*': there is no bare wildcard. Use one or…
- Client is not connected. Call start() first.
- Set environment variables via either the client-level env…
- connectionToken must be a non-empty string
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/77a9296391a60c14.
Report an issue: GitHub.
Appendix: source
Thrown at nodejs/src/client.ts:628
);
}
if (conn.kind === "inprocess" && options.workingDirectory !== undefined) {
throw new Error(
"workingDirectory is not supported with RuntimeConnection.forInProcess(): the in-process " +
"transport hosts the runtime in this process, so honoring it would require mutating the " +
"shared process-global cwd. Change the host process's working directory before " +
"constructing the client instead."
);
}
if (conn.kind === "inprocess" && options.env !== undefined) {
throw new Error(
"env is not supported with RuntimeConnection.forInProcess(): 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 (conn.kind === "inprocess" && options.telemetry !== undefined) {
throw new Error(
"telemetry is not supported with RuntimeConnection.forInProcess(): 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 (
(conn.kind === "stdio" || conn.kind === "tcp") &&
conn.env !== undefined &&
options.env !== undefined
) {
throw new Error(
"Set environment variables via either the client-level env option or the connection's env " +
"(RuntimeConnection.forStdio/forTcp), not both. Prefer the connection-level env for " +
"child-process transports."
);
}
if (conn.kind === "tcp" && conn.connectionToken !== undefined) {View on GitHub (pinned to cd8cf15dc3)