shareAI-lab/learn-claude-code · error · RuntimeError
unable to load integrated host from {path}
Error message
unable to load integrated host from {path} What it means
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.
Source
Thrown at s16_workflow_runtime/code.py:802
base_assemble = host.assemble_tool_pool
def assemble_with_workflow():
tools, handlers = base_assemble()
if not any(tool.get("name") == "Workflow" for tool in tools):
tools.append(WORKFLOW_TOOL)
handlers["Workflow"] = run_workflow_sync
return tools, handlers
host.assemble_tool_pool = assemble_with_workflow
host._workflow_tool_installed = True
def load_integrated_host():
"""Load s15 lazily so deterministic workflow tests need no API key."""
path = Path(__file__).resolve().parents[1] / "s15_integrated_harness" / "code.py"
spec = importlib.util.spec_from_file_location("integrated_host", path)
if spec is None or spec.loader is None:
raise RuntimeError(f"unable to load integrated host from {path}")
host = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = host
spec.loader.exec_module(host)
return host
# -- CLI --
async def run_demo(argv):
resume_id = None
if argv and argv[0] == "resume":
resume_id = _read_last_run()
if not resume_id:
print("nothing to resume; run `python code.py demo` first.")
return
print(f"resuming {resume_id}; unchanged agent() calls use the journal cache\n")
else:
print("launching workflow `review-changes`\n")
View on GitHub (pinned to 985456f4ad)
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.
Example fix
# before
path = Path(__file__).resolve().parents[1] / "s15_integrated_harness" / "code.py"
# missing in this deployment -> RuntimeError
# after
path = Path(__file__).resolve().parents[1] / "harness" / "s15_code.py" # actual location
assert path.exists(), f"integrated host missing at {path}" Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
host_path = Path(__file__).resolve().parents[1] / "s15_integrated_harness" / "code.py"
if not host_path.is_file():
raise FileNotFoundError(f"s15 harness missing at {host_path}; cannot assemble integrated host") Try / catch
try:
host = load_integrated_host()
except RuntimeError as e:
if "unable to load integrated host" in str(e):
log_env_issue(e) # report packaging/checkout problem; degrade to non-integrated mode
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable to load memory runtime from {path}
- Not in a git repository. worktree tools require git.
- Memory directory escapes the workspace
- could not allocate a unique workflow runId
- invalid workflow runId
AI-assisted analysis of shareAI-lab/learn-claude-code@985456f4ad (2026-08-14).
Data as JSON: /api/errors/8f2dfddb89c17d00.
Report an issue: GitHub.