{"record":{"id":"d6abb595e9e91ffa","repo":"charmbracelet/crush","slug":"failed-to-enable-docker-mcp-w","errorCode":null,"errorMessage":"failed to enable docker MCP: %w","messagePattern":"failed to enable docker MCP: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/client/config.go","lineNumber":267,"sourceCode":"\tif err := json.NewDecoder(rsp.Body).Decode(&result); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to decode skill response: %w\", err)\n\t}\n\treturn &result, nil\n}\n\n// MCPResourceContents holds the contents of an MCP resource.\ntype MCPResourceContents struct {\n\tURI      string `json:\"uri\"`\n\tMIMEType string `json:\"mime_type,omitempty\"`\n\tText     string `json:\"text,omitempty\"`\n\tBlob     []byte `json:\"blob,omitempty\"`\n}\n\n// EnableDockerMCP enables the Docker MCP server on the workspace.\nfunc (c *Client) EnableDockerMCP(ctx context.Context, id string) error {\n\trsp, err := c.post(ctx, fmt.Sprintf(\"/workspaces/%s/mcp/docker/enable\", id), nil, nil, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to enable docker MCP: %w\", err)\n\t}\n\tdefer rsp.Body.Close()\n\tif rsp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"failed to enable docker MCP: status code %d\", rsp.StatusCode)\n\t}\n\treturn nil\n}\n\n// DisableDockerMCP disables the Docker MCP server on the workspace.\nfunc (c *Client) DisableDockerMCP(ctx context.Context, id string) error {\n\trsp, err := c.post(ctx, fmt.Sprintf(\"/workspaces/%s/mcp/docker/disable\", id), nil, nil, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to disable docker MCP: %w\", err)\n\t}\n\tdefer rsp.Body.Close()\n\tif rsp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"failed to disable docker MCP: status code %d\", rsp.StatusCode)\n\t}","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/client/config.go#L249-L285","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nerr := client.EnableDockerMCP(ctx, wsID)\nif err != nil { return err }\n// after\nerr := client.EnableDockerMCP(ctx, wsID)\nif err != nil {\n    // transient network issues are common; retry once\n    if retryable(err) {\n        time.Sleep(2 * time.Second)\n        err = client.EnableDockerMCP(ctx, wsID)\n    }\n    if err != nil { return err }\n}","handlingStrategy":"retry","validationCode":"// Pre-check reachability before toggling MCP\nfunc canReach(baseURL string) bool {\n    resp, err := http.Get(baseURL + \"/health\")\n    if err != nil { return false }\n    resp.Body.Close()\n    return resp.StatusCode == http.StatusOK\n}","typeGuard":"func isRetryable(err error) bool {\n    var ne net.Error\n    if errors.As(err, &ne) { return true }\n    return errors.Is(err, context.DeadlineExceeded) || errors.Is(err, syscall.ECONNRESET)\n}","tryCatchPattern":"err := client.EnableDockerMCP(ctx, wsID)\nfor i := 0; err != nil && isRetryable(err) && i < 3; i++ {\n    time.Sleep(time.Duration(1<<i) * time.Second)\n    err = client.EnableDockerMCP(ctx, wsID)\n}\nif err != nil { return err }","preventionTips":["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."],"tags":["http-client","network","mcp","docker","wrapped-error"],"backgroundTag":"http-request-transport-failure","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}