BloopAI/vibe-kanban · error

Failed to load orchestrator MCP context from /api/containers

Error message

Failed to load orchestrator MCP context from /api/containers/attempt-context

What it means

At startup the orchestrator MCP task server fetches its workspace/attempt context from the deployment API endpoint /api/containers/attempt-context. In non-Global mode a missing or failed fetch is fatal, because the server cannot operate without its attempt context. This distinguishes 'no context exists' (None) from an actual request error, which is re-thrown with additional context.

Source

Thrown at crates/mcp/src/task_server/mod.rs:115

        self.context = context;
        Ok(self)
    }

    pub fn mode(&self) -> &McpMode {
        &self.mode
    }

    async fn fetch_context_at_startup(&self) -> anyhow::Result<Option<McpContext>> {
        let current_dir = std::env::current_dir().context("Failed to resolve current directory")?;
        let canonical_path = current_dir.canonicalize().unwrap_or(current_dir);
        let normalized_path = utils::path::normalize_macos_private_alias(&canonical_path);

        match self.try_fetch_attempt_context(&normalized_path).await {
            Ok(Some(ctx)) => Ok(Some(
                self.build_mcp_context_from_workspace_context(&ctx).await,
            )),
            Ok(None) | Err(_) if matches!(self.mode(), McpMode::Global) => Ok(None),
            Ok(None) => anyhow::bail!(
                "Failed to load orchestrator MCP context from /api/containers/attempt-context"
            ),
            Err(error) => Err(error.context("Failed to load orchestrator MCP context")),
        }
    }

    async fn try_fetch_attempt_context(
        &self,
        path: &Path,
    ) -> anyhow::Result<Option<WorkspaceContext>> {
        let url = self.url("/api/containers/attempt-context");
        let query = ContainerQuery {
            container_ref: path.to_string_lossy().to_string(),
        };

        let response = tokio::time::timeout(
            std::time::Duration::from_millis(500),
            self.client.get(&url).query(&query).send(),

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Verify the API base URL and auth credentials for /api/containers/attempt-context
  2. Ensure the deployment/attempt exists and is registered before starting the MCP server
  3. Check network connectivity from the container to the deployment API
  4. If this instance should run standalone, configure it in Global mode

Example fix

// before
McpServer::new(McpMode::Task) // requires attempt-context
// after
McpServer::new(McpMode::Global) // or ensure attempt-context is reachable before init
Defensive patterns

Strategy: retry

Try / catch

let ctx = match fetch_context_at_startup().await { Ok(c) => c, Err(e) if e.to_string().contains("Failed to load orchestrator MCP context") => { sleep(backoff).await; retry_limited(3).await? } };

Prevention

When it happens

Trigger: fetch_context_at_startup called during init in orchestrator/non-global mode; try_fetch_attempt_context returns Ok(None) or the HTTP request fails (network error, non-2xx, bad auth).

Common situations: Container started before the deployment API is reachable; wrong API base URL or missing auth token; attempt not yet registered server-side so the endpoint returns empty; stale container pointing at a deleted attempt.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/d3eac161fe1078db. Report an issue: GitHub.