{"record":{"id":"77a9296391a60c14","repo":"github/copilot-sdk","slug":"telemetry-is-not-supported-with-runtimeconnection","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":628,"sourceCode":"            );\n        }\n        if (conn.kind === \"inprocess\" && options.workingDirectory !== undefined) {\n            throw new Error(\n                \"workingDirectory is not supported with RuntimeConnection.forInProcess(): the in-process \" +\n                    \"transport hosts the runtime in this process, so honoring it would require mutating the \" +\n                    \"shared process-global cwd. Change the host process's working directory before \" +\n                    \"constructing the client instead.\"\n            );\n        }\n        if (conn.kind === \"inprocess\" && options.env !== undefined) {\n            throw new Error(\n                \"env is not supported with RuntimeConnection.forInProcess(): the in-process transport loads \" +\n                    \"the native runtime into the shared host process, whose single environment block cannot \" +\n                    \"carry per-client values. Set the variables on the host process environment instead.\"\n            );\n        }\n        if (conn.kind === \"inprocess\" && options.telemetry !== undefined) {\n            throw new Error(\n                \"telemetry is not supported with RuntimeConnection.forInProcess(): telemetry configuration \" +\n                    \"is lowered to environment variables read by native runtime code running in the shared \" +\n                    \"host process, so per-client telemetry cannot be honored in-process. Configure telemetry \" +\n                    \"via the host process environment, or use a child-process transport.\"\n            );\n        }\n        if (\n            (conn.kind === \"stdio\" || conn.kind === \"tcp\") &&\n            conn.env !== undefined &&\n            options.env !== undefined\n        ) {\n            throw new Error(\n                \"Set environment variables via either the client-level env option or the connection's env \" +\n                    \"(RuntimeConnection.forStdio/forTcp), not both. Prefer the connection-level env for \" +\n                    \"child-process transports.\"\n            );\n        }\n        if (conn.kind === \"tcp\" && conn.connectionToken !== undefined) {","sourceCodeStart":610,"sourceCodeEnd":646,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L610-L646","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait client.resume_session(\"session-123\", on_permission_request=\"approve_all\")\n// after\nawait client.resume_session(\"session-123\", on_permission_request=lambda req: req.approve())","handlingStrategy":"validation","validationCode":"if on_permission_request is not None and not callable(on_permission_request):\n    raise TypeError(\"on_permission_request must be callable\")","typeGuard":"def is_permission_handler(cb) -> bool:\n    return cb is None or callable(cb)","tryCatchPattern":"try:\n    await client.resume_session(\"session-123\", on_permission_request=cb)\nexcept ValueError as e:\n    if \"must be callable\" in str(e):\n        await client.resume_session(\"session-123\")  # omit broken callback","preventionTips":["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."],"tags":["argument-validation","callback","python"],"backgroundTag":"invalid-argument-value","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}