dagger/dagger · error · RuntimeException
Cannot fetch informations from process session
Error message
Cannot fetch informations from process session
What it means
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'.
Source
Thrown at sdk/php/src/Connection/ProcessSessionConnection.php:121
$lines = explode("\n", (string) $output);
$validLines = array_filter($lines, function ($line) {
$this->logger->debug($line);
json_decode(trim($line));
return JSON_ERROR_NONE === json_last_error();
});
$sessionInformation = json_decode(array_shift($validLines));
$this->logger->info("Started Dagger session on port {$sessionInformation->port}");
return true;
}
}
return false;
});
if (null === $sessionInformation) {
throw new RuntimeException('Cannot fetch informations from process session');
}
$port = $sessionInformation->port;
$token = $sessionInformation->session_token;
$this->client = new Client('http://127.0.0.1:' . $port . '/query', [
'Authorization' => 'Basic ' . base64_encode($token . ':'),
]);
$this->sessionProcess = $process;
return $this->client;
}
/**
* @internal
*/
public function getSessionProcess(): ?ProcessView on GitHub (pinned to 82ba2681db)
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)
Example fix
// before $dagger = Dagger::connect(); // hangs/throws: old CLI emits no session json // after // terminal: dagger version -> update // curl -L https://dl.dagger.io/dagger/install.sh | DAGGER_VERSION=x.y.z sh $dagger = Dagger::connect();
Defensive patterns
Strategy: try-catch
Validate before calling
exec('dagger version 2>&1', $out, $code);
if ($code !== 0) { throw new \RuntimeException('dagger CLI not runnable: '.implode("\n", $out)); } Try / catch
try {
$client = Dagger::connect();
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'Cannot fetch informations from process session')) {
// inspect dagger CLI output manually / update CLI
}
throw $e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- tried to access non-existent state %q
- failed to start dagger session
- unknown sdk language
- build template tree: %w
- invalid value %s
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/58049e857f43ef57.
Report an issue: GitHub.