apache/seatunnel · error · FileNotFoundError
Session not found
Error message
Session not found: {session_id} What it means
MemoryManager.load_session() resolves the session file as <sessions_dir>/<session_id>.json and raises FileNotFoundError if that file does not exist. It signals that the requested conversation session was never created or has been deleted, so no history can be restored.
Solutions
- Call list_sessions() to find the correct existing session ID
- Start a new session instead of resuming if the old one is gone
- Verify you are pointing at the same sessions directory/config profile that created the session
- Catch FileNotFoundError and fall back to creating a fresh session
Example fix
// before
history, cfg = memory.load_session(args.session)
// after
try:
history, cfg = memory.load_session(args.session)
except FileNotFoundError:
history, cfg = memory.start_new_session() Defensive patterns
Strategy: try-catch
Validate before calling
from pathlib import Path
sessions_dir = memory.sessions_dir
assert (sessions_dir / f"{session_id}.json").exists(), f"Unknown session {session_id}" Type guard
def session_exists(memory, session_id: str) -> bool:
return (memory.sessions_dir / f"{session_id}.json").exists() Try / catch
try:
history, cfg = memory.load_session(session_id)
except FileNotFoundError:
available = memory.list_sessions()
print(f"Session {session_id} not found. Recent: {available}")
history, cfg = [], None Prevention
- Pick session IDs from list_sessions() output instead of retyping them
- Back up the sessions directory if conversations matter
- Confirm the same config/home directory is used across invocations
When it happens
Trigger: Calling load_session(session_id) with an ID whose JSON file is absent from the sessions directory — e.g. resuming with a mistyped or truncated ID, a session from another profile/machine, or one removed by cleanup.
Common situations: Manually copying commands between machines with different session stores; session pruned by retention/cleanup; typos when passing --session ids; switching SEATUNNEL home/config dirs.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Agent config file not found
- AmazonDocumentDB TLS CA bundle is not a readable file:
- Cannot fetch from another split - no split remaining.
- Checkpoint is enabled and job starts with savepoint, but…
- clickhouse local file not exists
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1d3913e7a17e4be2.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-cli/seatunnel_cli/memory.py:267
redacted_history = _redact_conversation_history(conversation_history)
redacted_config = redact_credentials(last_config) if last_config else last_config
data = {
"session_id": self.current_session_id,
"created_at": existing.get("created_at", _now_iso()),
"last_active": _now_iso(),
"summary": existing.get("summary", ""),
"message_count": len(conversation_history),
"last_config": redacted_config,
"conversation_history": redacted_history,
}
_atomic_write(path, data)
def load_session(self, session_id: str) -> tuple[list[dict], str | None]:
"""Load a session. Returns (conversation_history, last_config)."""
path = self.sessions_dir / f"{session_id}.json"
if not path.exists():
raise FileNotFoundError(f"Session not found: {session_id}")
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
self.current_session_id = session_id
return data.get("conversation_history", []), data.get("last_config")
def list_sessions(self, limit: int = 10) -> list[dict]:
result = []
for f in sorted(self.sessions_dir.glob("*.json"), reverse=True):
try:
with open(f, "r", encoding="utf-8") as fh:
data = json.load(fh)
result.append({
"session_id": data.get("session_id", f.stem),
"created_at": data.get("created_at", ""),
"last_active": data.get("last_active", ""),
"summary": data.get("summary", ""),
"message_count": data.get("message_count", 0),
})View on GitHub (pinned to cf67b549a7)