{"record":{"id":"8f2dfddb89c17d00","repo":"shareAI-lab/learn-claude-code","slug":"unable-to-load-integrated-host-from-path","errorCode":null,"errorMessage":"unable to load integrated host from {path}","messagePattern":"unable to load integrated host from (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"s16_workflow_runtime/code.py","lineNumber":802,"sourceCode":"    base_assemble = host.assemble_tool_pool\n\n    def assemble_with_workflow():\n        tools, handlers = base_assemble()\n        if not any(tool.get(\"name\") == \"Workflow\" for tool in tools):\n            tools.append(WORKFLOW_TOOL)\n        handlers[\"Workflow\"] = run_workflow_sync\n        return tools, handlers\n\n    host.assemble_tool_pool = assemble_with_workflow\n    host._workflow_tool_installed = True\n\n\ndef load_integrated_host():\n    \"\"\"Load s15 lazily so deterministic workflow tests need no API key.\"\"\"\n    path = Path(__file__).resolve().parents[1] / \"s15_integrated_harness\" / \"code.py\"\n    spec = importlib.util.spec_from_file_location(\"integrated_host\", path)\n    if spec is None or spec.loader is None:\n        raise RuntimeError(f\"unable to load integrated host from {path}\")\n    host = importlib.util.module_from_spec(spec)\n    sys.modules[spec.name] = host\n    spec.loader.exec_module(host)\n    return host\n\n\n# -- CLI --\nasync def run_demo(argv):\n    resume_id = None\n    if argv and argv[0] == \"resume\":\n        resume_id = _read_last_run()\n        if not resume_id:\n            print(\"nothing to resume; run `python code.py demo` first.\")\n            return\n        print(f\"resuming {resume_id}; unchanged agent() calls use the journal cache\\n\")\n    else:\n        print(\"launching workflow `review-changes`\\n\")\n","sourceCodeStart":784,"sourceCodeEnd":820,"githubUrl":"https://github.com/shareAI-lab/learn-claude-code/blob/985456f4adea6f4df8fbad4112245dbd97444eae/s16_workflow_runtime/code.py#L784-L820","documentation":"load_integrated_host() lazily imports the s15 harness by building an importlib spec from the sibling path s15_integrated_harness/code.py; if spec or spec.loader is None (which importlib returns for paths it cannot load, e.g. missing file or unrecognized extension) it raises RuntimeError. This is a host-assembly/environment error, not a workflow-input error — it means the bundled demo/test harness files are not where the module expects them.","triggerScenarios":"Calling load_integrated_host() when s15_integrated_harness/code.py is absent from the repo checkout, or packaging that ships s16 without its sibling directory so spec_from_file_location yields no usable loader.","commonSituations":"Partial clones or trimmed deployment artifacts that omit s15; running s16 standalone from an installed location instead of the repository tree; renames/moves of the s15 directory breaking the parents[1] relative path.","solutions":["Restore the sibling directory so <repo>/s15_integrated_harness/code.py exists next to s16_workflow_runtime.","If the layout changed, update the hardcoded path in load_integrated_host() to the new location.","Skip features that need the integrated host (deterministic tests requiring no API key) or vendor the s15 module into the deployment."],"exampleFix":"# before\npath = Path(__file__).resolve().parents[1] / \"s15_integrated_harness\" / \"code.py\"\n# missing in this deployment -> RuntimeError\n\n# after\npath = Path(__file__).resolve().parents[1] / \"harness\" / \"s15_code.py\"  # actual location\nassert path.exists(), f\"integrated host missing at {path}\"","handlingStrategy":"validation","validationCode":"from pathlib import Path\nhost_path = Path(__file__).resolve().parents[1] / \"s15_integrated_harness\" / \"code.py\"\nif not host_path.is_file():\n    raise FileNotFoundError(f\"s15 harness missing at {host_path}; cannot assemble integrated host\")","typeGuard":null,"tryCatchPattern":"try:\n    host = load_integrated_host()\nexcept RuntimeError as e:\n    if \"unable to load integrated host\" in str(e):\n        log_env_issue(e)  # report packaging/checkout problem; degrade to non-integrated mode\n    raise","preventionTips":["Ship s16 and its s15 sibling directory together; treat the pair as one deployable unit.","Add a startup check that the sibling path exists before features depend on the integrated host.","Pin the repo layout, or make the harness path configurable, if you relocate modules."],"tags":["workflow","import","environment","packaging","runtime"],"backgroundTag":null,"analyzedSha":"985456f4adea6f4df8fbad4112245dbd97444eae","analyzedAt":"2026-08-14T22:02:26.028Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}