{"record":{"id":"58049e857f43ef57","repo":"dagger/dagger","slug":"cannot-fetch-informations-from-process-session","errorCode":null,"errorMessage":"Cannot fetch informations from process session","messagePattern":"Cannot fetch informations from process session","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdk/php/src/Connection/ProcessSessionConnection.php","lineNumber":121,"sourceCode":"                    $lines = explode(\"\\n\", (string) $output);\n                    $validLines = array_filter($lines, function ($line) {\n                        $this->logger->debug($line);\n                        json_decode(trim($line));\n\n                        return JSON_ERROR_NONE === json_last_error();\n                    });\n                    $sessionInformation = json_decode(array_shift($validLines));\n                    $this->logger->info(\"Started Dagger session on port {$sessionInformation->port}\");\n\n                    return true;\n                }\n            }\n\n            return false;\n        });\n\n        if (null === $sessionInformation) {\n            throw new RuntimeException('Cannot fetch informations from process session');\n        }\n\n        $port = $sessionInformation->port;\n        $token = $sessionInformation->session_token;\n\n        $this->client = new Client('http://127.0.0.1:' . $port . '/query', [\n            'Authorization' => 'Basic ' . base64_encode($token . ':'),\n        ]);\n\n        $this->sessionProcess = $process;\n\n        return $this->client;\n    }\n\n    /**\n     * @internal\n     */\n    public function getSessionProcess(): ?Process","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/sdk/php/src/Connection/ProcessSessionConnection.php#L103-L139","documentation":"startCliSession spawns the dagger CLI and waits for it to emit session JSON (port and session_token) on stdout/stderr. If the process exits or never prints parseable session information, the SDK throws 'Cannot fetch informations from process session'.","triggerScenarios":"The dagger CLI process fails to start or crashes before printing session info (bad binary, unsupported flags, engine startup failure), so the callback never returns session data and $sessionInformation stays null.","commonSituations":"Dagger CLI version too old for the SDK's expected session JSON output; engine startup failure (e.g. docker not running); the CLI crashing due to missing dependencies.","solutions":["Run 'dagger version' and update the CLI to match the SDK version","Verify the container runtime (docker/podman) is installed and running","Run the dagger command manually to see its actual error output","Check PATH resolves to the intended dagger binary (which dagger)"],"exampleFix":"// before\n$dagger = Dagger::connect(); // hangs/throws: old CLI emits no session json\n// after\n// terminal: dagger version -> update\n// curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=x.y.z sh\n$dagger = Dagger::connect();","handlingStrategy":"try-catch","validationCode":"exec('dagger version 2>&1', $out, $code);\nif ($code !== 0) { throw new \\RuntimeException('dagger CLI not runnable: '.implode(\"\\n\", $out)); }","typeGuard":null,"tryCatchPattern":"try {\n    $client = Dagger::connect();\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'Cannot fetch informations from process session')) {\n        // inspect dagger CLI output manually / update CLI\n    }\n    throw $e;\n}","preventionTips":["Keep dagger CLI version aligned with the SDK version","Ensure docker/podman engine is running before connecting","Run `dagger` manually once to surface hidden startup errors"],"tags":["session","cli","process"],"backgroundTag":"cli-session-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}