{"record":{"id":"9bce882399ab7ee5","repo":"shareAI-lab/learn-claude-code","slug":"unable-to-load-memory-runtime-from-path","errorCode":null,"errorMessage":"Unable to load memory runtime from {path}","messagePattern":"Unable to load memory runtime from (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"s15_integrated_harness/code.py","lineNumber":85,"sourceCode":"MAX_CONSECUTIVE_529 = 2\nMAX_RECOVERY_RETRIES = 2\nBASE_DELAY_MS = 500\nCONTEXT_LIMIT = 50000\nKEEP_RECENT_TOOL_RESULTS = 3\nPERSIST_THRESHOLD = 30000\nCONTINUATION_PROMPT = \"Continue from the previous response. Do not repeat completed work.\"\nPROMPT = \"\\033[36ms15 >> \\033[0m\"\nCLI_ACTIVE = False\n\n\ndef load_memory_runtime():\n    \"\"\"Load s09 once and share this host's client, model, and workspace.\"\"\"\n    path = Path(__file__).resolve().parents[1] / \"s09_memory\" / \"code.py\"\n    spec = importlib.util.spec_from_file_location(\n        f\"integrated_memory_{id(client)}\", path\n    )\n    if spec is None or spec.loader is None:\n        raise RuntimeError(f\"Unable to load memory runtime from {path}\")\n    runtime = importlib.util.module_from_spec(spec)\n    spec.loader.exec_module(runtime)\n    runtime.WORKDIR = WORKDIR\n    runtime.MEMORY_DIR = WORKDIR / \".memory\"\n    runtime.MEMORY_INDEX = runtime.MEMORY_DIR / \"MEMORY.md\"\n    runtime.client = client\n    runtime.MODEL = MODEL\n    return runtime\n\n\nMEMORY_RUNTIME = load_memory_runtime()\n\n\nclass ConsoleBroker:\n    \"\"\"Serialize normal prompts and worker permission questions on one stdin.\"\"\"\n\n    def __init__(self):\n        self._lock = threading.Lock()","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/shareAI-lab/learn-claude-code/blob/985456f4adea6f4df8fbad4112245dbd97444eae/s15_integrated_harness/code.py#L67-L103","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\npath = Path(__file__).resolve().parents[1] / \"s09_memory\" / \"code.py\"\nif not path.is_file():\n    raise SystemExit(f\"Missing dependency: {path}. Clone/place s09_memory next to s15_integrated_harness.\")","typeGuard":null,"tryCatchPattern":"try:\n    MEMORY_RUNTIME = load_memory_runtime()\nexcept RuntimeError as e:\n    raise SystemExit(f\"startup failed: {e}\") from e","preventionTips":["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."],"tags":["import","module-loading","environment","startup"],"backgroundTag":null,"analyzedSha":"985456f4adea6f4df8fbad4112245dbd97444eae","analyzedAt":"2026-08-14T22:02:26.028Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}