charmbracelet/crush · error
failed to enable docker MCP: %w
Error message
failed to enable docker MCP: %w
What it means
This error is returned by Client.EnableDockerMCP when the HTTP POST to /workspaces/{id}/mcp/docker/enable fails at the transport level. The request never produced an HTTP response, and the original cause (connection failure, timeout, cancellation) is preserved via %w. It is a connectivity/request-execution problem, not a server-side rejection.
Source
Thrown at internal/client/config.go:267
if err := json.NewDecoder(rsp.Body).Decode(&result); err != nil {
return nil, fmt.Errorf("failed to decode skill response: %w", err)
}
return &result, nil
}
// MCPResourceContents holds the contents of an MCP resource.
type MCPResourceContents struct {
URI string `json:"uri"`
MIMEType string `json:"mime_type,omitempty"`
Text string `json:"text,omitempty"`
Blob []byte `json:"blob,omitempty"`
}
// EnableDockerMCP enables the Docker MCP server on the workspace.
func (c *Client) EnableDockerMCP(ctx context.Context, id string) error {
rsp, err := c.post(ctx, fmt.Sprintf("/workspaces/%s/mcp/docker/enable", id), nil, nil, nil)
if err != nil {
return fmt.Errorf("failed to enable docker MCP: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to enable docker MCP: status code %d", rsp.StatusCode)
}
return nil
}
// DisableDockerMCP disables the Docker MCP server on the workspace.
func (c *Client) DisableDockerMCP(ctx context.Context, id string) error {
rsp, err := c.post(ctx, fmt.Sprintf("/workspaces/%s/mcp/docker/disable", id), nil, nil, nil)
if err != nil {
return fmt.Errorf("failed to disable docker MCP: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to disable docker MCP: status code %d", rsp.StatusCode)
}View on GitHub (pinned to 7944b8e522)
Solutions
- Check server reachability and the configured base URL.
- Inspect the wrapped cause (errors.Is/As) to classify: timeout vs refused vs cancelled.
- Retry with backoff for transient failures.
- Confirm the server version supports the docker MCP enable endpoint.
- Verify no proxy/firewall strips or blocks the POST.
Example fix
// before
err := client.EnableDockerMCP(ctx, wsID)
if err != nil { return err }
// after
err := client.EnableDockerMCP(ctx, wsID)
if err != nil {
// transient network issues are common; retry once
if retryable(err) {
time.Sleep(2 * time.Second)
err = client.EnableDockerMCP(ctx, wsID)
}
if err != nil { return err }
} Defensive patterns
Strategy: retry
Validate before calling
// Pre-check reachability before toggling MCP
func canReach(baseURL string) bool {
resp, err := http.Get(baseURL + "/health")
if err != nil { return false }
resp.Body.Close()
return resp.StatusCode == http.StatusOK
} Type guard
func isRetryable(err error) bool {
var ne net.Error
if errors.As(err, &ne) { return true }
return errors.Is(err, context.DeadlineExceeded) || errors.Is(err, syscall.ECONNRESET)
} Try / catch
err := client.EnableDockerMCP(ctx, wsID)
for i := 0; err != nil && isRetryable(err) && i < 3; i++ {
time.Sleep(time.Duration(1<<i) * time.Second)
err = client.EnableDockerMCP(ctx, wsID)
}
if err != nil { return err } Prevention
- Use a context timeout appropriate for control-plane calls.
- Retry transient transport errors with exponential backoff.
- Confirm server version supports the docker MCP enable route before calling.
- Avoid enabling during server deploys/restarts.
When it happens
Trigger: Calling EnableDockerMCP(ctx, workspaceID) while the server is unreachable, the connection drops mid-request, the context expires, or c.post fails to build the request.
Common situations: Control-plane server not running; Docker MCP feature requires a newer server that doesn't yet expose the route at that host; network policy blocks POSTs; transient network blip in CI.
Related errors
- failed to disable docker MCP: %w
- failed to list skills: %w
- failed to read skill: %w
- failed to enable docker MCP: status code %d
- failed to disable docker MCP: status code %d
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/d6abb595e9e91ffa.
Report an issue: GitHub.