can1357/oh-my-pi · error · HTTPException

workspace not found: {workspace_key}

Error message

workspace not found: {workspace_key}

What it means

After validating the workspace_key prefix, `git_push_endpoint` resolves the workspace directory via `_workspace_repo_dir` and requires it to exist. If no directory exists for that workspace_key on the proxy host, it returns HTTP 404. The proxy has no cloned workspace under that key to push from.

Source

Thrown at python/robomp/src/proxy/server.py:920

        except GitCommandError as exc:
            return _git_error_response(exc)
        return JSONResponse({"pool_dir": str(target)})

    @app.post("/gh/v1/git/push")
    async def git_push_endpoint(request: Request) -> JSONResponse:
        data = await _json_body(request)
        repo = _require_str(data.get("repo"), "repo")
        workspace_key = _require_str(data.get("workspace_key"), "workspace_key")
        branch = _require_branch(data.get("branch"))
        expected_head = _require_str(data.get("expected_head"), "expected_head")
        slot_uid = _optional_slot_uid(data.get("slot_uid"))
        # Sanity-check workspace_key matches the repo claim.
        expected_prefix = repo.replace("/", "__") + "__"
        if not workspace_key.startswith(expected_prefix):
            raise HTTPException(400, "workspace_key does not match repo")
        repo_dir = _workspace_repo_dir(settings, workspace_key)
        if not repo_dir.is_dir():
            raise HTTPException(404, f"workspace not found: {workspace_key}")
        remote = await asyncio.to_thread(
            _origin_remote_auth,
            repo_dir,
            repo,
            _resolve_token(settings),
            push=True,
            slot_uid=slot_uid,
        )
        try:
            result = await _run_git_op(
                git_push,
                repo_dir,
                branch=branch,
                expected_head=expected_head,
                token=remote.token,
                remote_url=remote.url,
                auth_url=remote.auth_url,
                slot_uid=slot_uid,

View on GitHub (pinned to 9690622007)

Solutions

  1. Re-clone the repo through the proxy (git/clone) to recreate the workspace before pushing
  2. Verify you are calling the same proxy instance/deployment that owns the workspace
  3. Check proxy workspace storage configuration/persistence across restarts
  4. Confirm the workspace_key string is correct (no truncation or stale cache)

Example fix

// before: push against a vanished workspace
await push({ workspace_key: "owner__repo__old-task" })
// after: recreate the workspace first
await clone({ repo: "owner/repo", clone_url, workspace_key: "owner__repo__new-task" })
await push({ repo: "owner/repo", workspace_key: "owner__repo__new-task", ... })
Defensive patterns

Strategy: try-catch

Validate before calling

# probe whether the workspace exists before pushing
probe = proxy.git_fetch(repo=repo, workspace_key=key)  # or track workspace lifecycle client-side
# if you have filesystem/API access: verify the workspace dir exists for this proxy instance

Try / catch

try:
    proxy.git_push(repo=repo, workspace_key=key, ...)
except HTTPError as e:
    if e.response.status_code == 404 and "workspace not found" in e.response.text:
        proxy.git_clone(repo=repo, clone_url=clone_url, workspace_key=key)  # recreate
        proxy.git_push(repo=repo, workspace_key=key, ...)  # retry once
    else:
        raise

Prevention

When it happens

Trigger: POSTing to /gh/v1/git/push with a workspace_key that was never cloned on this proxy instance, was garbage-collected/cleaned up, or exists on a different proxy deployment than the one being called.

Common situations: Proxy restarted with ephemeral storage wiping workspaces, calling a different proxy replica than the one holding the workspace, stale workspace_key cached by the client after cleanup, or typo in the key suffix.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/c6f73a5eea2409ee. Report an issue: GitHub.