{"record":{"id":"19b1959224e557d3","repo":"cloudflare/cloudflared","slug":"quick-tunnel-provisioning-failed-s","errorCode":null,"errorMessage":"quick tunnel provisioning failed: %s","messagePattern":"quick tunnel provisioning failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/quick_tunnel.go","lineNumber":101,"sourceCode":"\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\tvar data QuickTunnelResponse\n\t\tif err := json.Unmarshal(respBody, &data); err == nil && len(data.Errors) > 0 {\n\t\t\treturn fmt.Errorf(\"quick tunnel provisioning failed with status %d: %s\", resp.StatusCode, formatQuickTunnelErrors(data.Errors))\n\t\t}\n\t\treturn fmt.Errorf(\"quick tunnel provisioning failed with status %d: %s\", resp.StatusCode, string(respBody))\n\t}\n\n\tvar data QuickTunnelResponse\n\tif err := json.Unmarshal(respBody, &data); err != nil {\n\t\trespString := string(respBody)\n\t\tfields := map[string]interface{}{\"status_code\": resp.Status}\n\t\tsc.log.Err(err).Fields(fields).Msgf(\"Error unmarshaling QuickTunnel response: %s\", respString)\n\t\treturn errors.Wrap(err, \"failed to unmarshal quick Tunnel\")\n\t}\n\n\t// TODO(TUN-10791): Add CLI-level coverage that provisioning errors are logged to users.\n\tif len(data.Errors) > 0 {\n\t\treturn fmt.Errorf(\"quick tunnel provisioning failed: %s\", formatQuickTunnelErrors(data.Errors))\n\t}\n\n\tif !data.Success {\n\t\treturn errors.New(\"quick tunnel provisioning failed\")\n\t}\n\n\ttunnelID, err := uuid.Parse(data.Result.ID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse quick Tunnel ID\")\n\t}\n\n\tcredentials := connection.Credentials{\n\t\tAccountTag:   data.Result.AccountTag,\n\t\tTunnelSecret: data.Result.Secret,\n\t\tTunnelID:     tunnelID,\n\t}\n\n\turl := data.Result.Hostname","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/quick_tunnel.go#L83-L119","documentation":"After a 2xx response, RunQuickTunnel unmarshals the body; if the parsed QuickTunnelResponse has a non-empty `errors` array, provisioning is treated as failed and the formatted API errors are returned even though HTTP said success. The API reports application-level failures inside an HTTP 200 envelope.","triggerScenarios":"The provisioning API returns HTTP 200 with a JSON body where `success` handling is deferred and `errors` is populated — application-level rejection such as capacity or policy errors.","commonSituations":"Cloudflare-side capacity/policy rejections delivered as 200+errors; API contract changes between cloudflared versions and the provisioning backend; intermediaries that rewrite the body while keeping the 200 status.","solutions":["Read the formatted API errors in the message for the exact application-level cause","Retry — many application-level provisioning failures are transient","Update cloudflared to the latest version in case the API contract changed","Fall back to a named tunnel if quick tunnels remain rejected in your environment"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var probe QuickTunnelResponse\nif err := json.Unmarshal(respBody, &probe); err == nil && len(probe.Errors) > 0 {\n    return fmt.Errorf(\"API-level errors despite HTTP 200: %v\", probe.Errors)\n}","typeGuard":"func hasAPIErrors(r QuickTunnelResponse) bool { return len(r.Errors) > 0 }","tryCatchPattern":"tunnel, err := RunQuickTunnel(c)\nif err != nil {\n    log.Error().Err(err).Msg(\"quick tunnel rejected; check formatted API errors\")\n    return err\n}","preventionTips":["Keep cloudflared up to date so the QuickTunnelResponse contract stays in sync with the API","Treat HTTP 200 as insufficient — always check the parsed errors array in API responses","Retry transient application-level errors with backoff before giving up","Use named tunnels where provisioning guarantees matter"],"tags":["network","http","quick-tunnel","api"],"backgroundTag":"upstream-api-error","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}