shareAI-lab/learn-claude-code · critical · RuntimeError
Unable to load memory runtime from {path}
Error message
Unable to load memory runtime from {path} What it means
load_memory_runtime() dynamically imports the s09_memory module via importlib.util.spec_from_file_location; if the returned spec or its loader is None, Python could not build an importable module for the file at <repo>/s09_memory/code.py. This is a host-environment failure at harness startup (the call runs at module import time), not a runtime argument error.
Source
Thrown at s15_integrated_harness/code.py:85
MAX_CONSECUTIVE_529 = 2
MAX_RECOVERY_RETRIES = 2
BASE_DELAY_MS = 500
CONTEXT_LIMIT = 50000
KEEP_RECENT_TOOL_RESULTS = 3
PERSIST_THRESHOLD = 30000
CONTINUATION_PROMPT = "Continue from the previous response. Do not repeat completed work."
PROMPT = "\033[36ms15 >> \033[0m"
CLI_ACTIVE = False
def load_memory_runtime():
"""Load s09 once and share this host's client, model, and workspace."""
path = Path(__file__).resolve().parents[1] / "s09_memory" / "code.py"
spec = importlib.util.spec_from_file_location(
f"integrated_memory_{id(client)}", path
)
if spec is None or spec.loader is None:
raise RuntimeError(f"Unable to load memory runtime from {path}")
runtime = importlib.util.module_from_spec(spec)
spec.loader.exec_module(runtime)
runtime.WORKDIR = WORKDIR
runtime.MEMORY_DIR = WORKDIR / ".memory"
runtime.MEMORY_INDEX = runtime.MEMORY_DIR / "MEMORY.md"
runtime.client = client
runtime.MODEL = MODEL
return runtime
MEMORY_RUNTIME = load_memory_runtime()
class ConsoleBroker:
"""Serialize normal prompts and worker permission questions on one stdin."""
def __init__(self):
self._lock = threading.Lock()View on GitHub (pinned to 985456f4ad)
Solutions
- Restore or copy the s09_memory/code.py module so it sits next to s15_integrated_harness (parent-relative path: <repo>/s09_memory/code.py).
- If you relocated s09, patch the path in load_memory_runtime() to point at the new location.
- Check file readability (permissions, mount) for s09_memory/code.py before re-running the harness.
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
path = Path(__file__).resolve().parents[1] / "s09_memory" / "code.py"
if not path.is_file():
raise SystemExit(f"Missing dependency: {path}. Clone/place s09_memory next to s15_integrated_harness.") Try / catch
try:
MEMORY_RUNTIME = load_memory_runtime()
except RuntimeError as e:
raise SystemExit(f"startup failed: {e}") from e Prevention
- Keep s09_memory and s15_integrated_harness in the same parent directory in deploys.
- Add a startup existence check for sibling module paths before importing the harness.
- Include sibling stage directories in archives/CI artifacts, not just s15.
When it happens
Trigger: Running s15_integrated_harness/code.py when the sibling directory s09_memory/code.py is missing, is a directory, has an unsupported/unknown extension (no .py suffix handled), or when the file cannot be stat'd due to permissions. spec_from_file_location returns None for unrecognized file types; loader can be None for namespace-package-like paths.
Common situations: Copying s15 without its s09 dependency sibling; partial clone or archive that skipped s09_memory; renaming code.py (e.g. to code.pyx or memory.py) without updating the hardcoded relative path; read-only mount where the path resolves but cannot be loaded.
Related errors
- unable to load integrated host from {path}
- Not in a git repository. worktree tools require git.
- Memory directory escapes the workspace
- Install dependencies first: pip install -r requirements.txt
- MODEL_ID is required in the environment or .env
AI-assisted analysis of shareAI-lab/learn-claude-code@985456f4ad (2026-08-14).
Data as JSON: /api/errors/9bce882399ab7ee5.
Report an issue: GitHub.