cloudflare/cloudflared · error

Received unknown connection type: %s

Error message

Received unknown connection type: %s

What it means

ServeHTTP switches on the connection type (TypeHTTP, TypeWebsocket, TypeTCP). If connType matches none of the known types, it falls to the default branch and returns `Received unknown connection type: %s`. This indicates the edge sent a connection type this cloudflared version does not understand.

Source

Thrown at connection/http2.go:154

	case TypeTCP:
		host, err := getRequestHost(r)
		if err != nil {
			requestErr = fmt.Errorf(`cloudflared received a warp-routing request with an empty host value: %w`, err)
			break
		}

		rws := NewHTTPResponseReadWriterAcker(respWriter, respWriter, r)
		requestErr = originProxy.ProxyTCP(r.Context(), rws, &TCPRequest{
			Dest:      host,
			CFRay:     FindCfRayHeader(r),
			LBProbe:   IsLBProbeRequest(r),
			CfTraceID: r.Header.Get(tracing.TracerContextName),
			ConnIndex: c.connIndex,
		})

	default:
		requestErr = fmt.Errorf("Received unknown connection type: %s", connType)
	}

	if requestErr != nil {
		c.log.Error().Err(requestErr).Msg("failed to serve incoming request")

		// WriteErrorResponse will return false if status was already written. we need to abort handler.
		if !respWriter.WriteErrorResponse(requestErr) {
			c.log.Debug().Msg("Handler aborted due to failure to write error response after status already sent")
			panic(http.ErrAbortHandler)
		}
	}
}

// ConfigurationUpdateBody is the representation followed by the edge to send updates to cloudflared.
type ConfigurationUpdateBody struct {
	Version int32             `json:"version"`
	Config  gojson.RawMessage `json:"config"`
}

View on GitHub (pinned to 2253eeeb25)

Solutions

  1. Upgrade cloudflared to the latest release so it recognizes newer connection types
  2. Check the logged connType value to identify what the edge sent
  3. If it persists on the latest version, report the edge protocol mismatch to Cloudflare
  4. Restart the tunnel to re-establish edge connections after upgrading
Defensive patterns

Strategy: fallback

Try / catch

if err != nil && strings.HasPrefix(err.Error(), "Received unknown connection type:") {
    log.Warn().Err(err).Msg("edge sent unrecognized connection type; consider upgrading cloudflared")
}

Prevention

When it happens

Trigger: The edge delivers a request whose connType value (derived from the request metadata/cf-cloudflared-connection-type style header) is not one of the Type* constants compiled into this binary.

Common situations: Running an outdated cloudflared against a newer edge that routes new connection types, corrupted/absent connection-type metadata on the request, or testing edge request handling with hand-crafted requests.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06). Data as JSON: /api/errors/5d6e3b8d4e02152b. Report an issue: GitHub.