xai-org/grok-build · error · io::Error
session directory is unknown; cannot probe disk space
Error message
session directory is unknown; cannot probe disk space
What it means
The writability/disk-space probe (probe_writable) derives the session directory as the parent of the updates file path; when storage.updates_file_path(&self.info) returns None (or has no parent), the probe cannot determine where to check disk space and fails with io::ErrorKind::NotFound before any spawn_blocking work.
Source
Thrown at crates/codegen/xai-grok-shell/src/session/persistence.rs:1603
message: DISK_FULL_USER_MESSAGE.to_string(),
}),
meta: None,
};
if let Ok(params) = serde_json::value::to_raw_value(¬ification) {
gateway.forward_fire_and_forget(acp::ExtNotification::new(
"x.ai/session_notification",
params.into(),
));
}
}
async fn probe_writable(&self) -> io::Result<()> {
let dir = self
.storage
.updates_file_path(&self.info)
.and_then(|path| path.parent().map(Path::to_path_buf))
.ok_or_else(|| {
io::Error::new(
io::ErrorKind::NotFound,
"session directory is unknown; cannot probe disk space",
)
})?;
tokio::task::spawn_blocking(move || {
std::fs::create_dir_all(&dir)?;
let probe = dir.join(".disk_ok");
std::fs::write(&probe, b"ok")?;
let _ = std::fs::remove_file(&probe);
io::Result::Ok(())
})
.await
.map_err(io::Error::other)?
}
fn queue_acp_sync(&self, notification: acp::SessionNotification) {
if let Some(sync) = &self.remote_sync {
sync.queue(notification.clone());View on GitHub (pinned to bc7f02eddd)
Solutions
- Ensure the session is fully initialized (valid id and storage path) before probing writability
- Check the storage configuration so updates_file_path returns a real filesystem path
- Initialize the session directory explicitly before starting persistence
- Skip the probe or supply a default session directory when the path is unknown
Example fix
// before: probing immediately after constructing an uninitialized session persist.probe_writable().await?; // after: initialize first let persist = SessionPersistence::init(info, storage).await?; persist.probe_writable().await?;
Defensive patterns
Strategy: validation
Validate before calling
let dir = storage.updates_file_path(&info)
.and_then(|p| p.parent().map(Path::to_path_buf));
if dir.as_ref().map_or(true, |d| !d.exists()) {
bail!("session directory unknown/uninitialized; initialize session before probing disk space");
} Type guard
fn session_dir_known(storage: &Storage, info: &SessionInfo) -> bool {
storage.updates_file_path(info)
.and_then(|p| p.parent().map(|_| ()))
.is_some()
} Try / catch
match persist.probe_writable().await {
Err(e) if e.kind() == io::ErrorKind::NotFound => {
eprintln!("session dir unknown; re-initialize session before probing");
persist = SessionPersistence::init(info, storage).await?;
persist.probe_writable().await?;
}
other => other?,
} Prevention
- Always fully initialize a session (valid id, assigned storage path) before writability probes
- Validate session info/id at construction time
- Use a filesystem-backed storage config when disk-space probing matters
- Log updates_file_path early to catch None-producing configs immediately
When it happens
Trigger: Calling probe_writable on a persistence instance whose updates_file_path resolves to None — e.g. session info lacks a valid session id/path mapping, or storage backend is not filesystem-backed.
Common situations: Session opened with a synthetic/empty id before the directory was assigned; storage configured to a mode that doesn't produce a path; probing before session initialization completed.
Related errors
- Failed to set working directory to {:?}: {}
- failed to read {}: {e}
- failed to write {}: {e}
- failed to create chrome trace {:?}: {}
- failed to read {}: {e}
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/f6024aea22f27fea.
Report an issue: GitHub.