{"record":{"id":"6dfb2f1e6352120e","repo":"cloudflare/cloudflared","slug":"flow-not-found","errorCode":null,"errorMessage":"flow not found","messagePattern":"flow not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quic/v3/manager.go","lineNumber":17,"sourceCode":"package v3\n\nimport (\n\t\"errors\"\n\t\"sync\"\n\n\t\"github.com/rs/zerolog\"\n\n\t\"github.com/cloudflare/cloudflared/ingress\"\n\t\"github.com/cloudflare/cloudflared/management\"\n\n\tcfdflow \"github.com/cloudflare/cloudflared/flow\"\n)\n\nvar (\n\t// ErrSessionNotFound indicates that a session has not been registered yet for the request id.\n\tErrSessionNotFound = errors.New(\"flow not found\")\n\t// ErrSessionBoundToOtherConn is returned when a registration already exists for a different connection.\n\tErrSessionBoundToOtherConn = errors.New(\"flow is in use by another connection\")\n\t// ErrSessionAlreadyRegistered is returned when a registration already exists for this connection.\n\tErrSessionAlreadyRegistered = errors.New(\"flow is already registered for this connection\")\n\t// ErrSessionRegistrationRateLimited is returned when a registration fails due to rate limiting on the number of active flows.\n\tErrSessionRegistrationRateLimited = errors.New(\"flow registration rate limited\")\n)\n\ntype SessionManager interface {\n\t// RegisterSession will register a new session if it does not already exist for the request ID.\n\t// During new session creation, the session will also bind the UDP socket for the origin.\n\t// If the session exists for a different connection, it will return [ErrSessionBoundToOtherConn].\n\tRegisterSession(request *UDPSessionRegistrationDatagram, conn DatagramConn) (Session, error)\n\t// GetSession returns an active session if available for the provided connection.\n\t// If the session does not exist, it will return [ErrSessionNotFound]. If the session exists for a different\n\t// connection, it will return [ErrSessionBoundToOtherConn].\n\tGetSession(requestID RequestID) (Session, error)\n\t// UnregisterSession will remove a session from the current session manager. It will attempt to close the session","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/quic/v3/manager.go#L1-L35","documentation":"ErrSessionNotFound (message 'flow not found') indicates that no session has been registered for the given request ID in the SessionManager. GetSession looks up its internal session map and returns this sentinel when the key is absent. It is the normal signal that a payload datagram arrived for an unknown or expired flow.","triggerScenarios":"Calling manager.GetSession(requestID) for an ID that was never registered, was already unregistered, or whose session timed out.","commonSituations":"UDP packets arriving after session teardown/expiry before the client re-registers; mismatched RequestIDs between client and server; sending payload datagrams before the registration response is processed.","solutions":["Register the session via RegisterSession and wait for the registration response before sending payload datagrams","Handle errors.Is(err, v3.ErrSessionNotFound) by dropping the packet and sending an ICMP port-unreachable-style response or a registration challenge to the client","Check for session idle timeout/expiry configuration that is too aggressive for your traffic pattern","Verify the RequestID used for lookup matches the one used at registration"],"exampleFix":"// before\nsession, err := manager.GetSession(datagram.RequestID())\nif err != nil {\n    return err // aborts handling on unknown flows\n}\n// after\nsession, err := manager.GetSession(datagram.RequestID())\nif errors.Is(err, v3.ErrSessionNotFound) {\n    // respond with registration-required response and drop packet\n    conn.SendRegistrationRequired(datagram.RequestID())\n    return nil\n} else if err != nil {\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// no pre-check available; existence is only knowable via GetSession\n// optionally track registered RequestIDs locally before lookup","typeGuard":null,"tryCatchPattern":"session, err := manager.GetSession(requestID)\nif errors.Is(err, v3.ErrSessionNotFound) {\n    // unknown/expired flow: prompt re-registration or drop packet\n    return\n} else if err != nil {\n    return err\n}","preventionTips":["Complete registration before sending payload datagrams","Tune idle timeouts to outlast typical flow gaps","Handle post-teardown packets by answering with a registration-required response","Log unknown RequestIDs to spot client ID mismatches"],"tags":["quic","session","not-found","udp"],"backgroundTag":"resource-not-found","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"}