{"record":{"id":"90baa0adba16d3c5","repo":"cilium/cilium","slug":"failed-to-find-proxy-port-s","errorCode":null,"errorMessage":"failed to find proxy port %s","messagePattern":"failed to find proxy port (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/proxy/proxyports/proxyports.go","lineNumber":419,"sourceCode":"\t\t\tlogfields.ProxyPort, pp.ProxyPort,\n\t\t)\n\t\tp.datapathUpdater.InstallProxyRules(pp.ProxyPort, name)\n\t\tpp.rulesPort = pp.ProxyPort\n\n\t\t// trigger writing proxy ports to file\n\t\tp.Trigger.Trigger()\n\t}\n\tpp.acknowledged = true\n\tscopedLog.Debug(\"AckProxyPort: acked proxy port\", logfields.ProxyPort, pp.ProxyPort)\n\treturn nil\n}\n\n// releaseProxyPort() decreases the use count and frees the port if no users remain\n// Must be called with mutex held!\nfunc (p *ProxyPorts) releaseProxyPort(name string, portReuseWait time.Duration) error {\n\tpp := p.proxyPorts[name]\n\tif pp == nil {\n\t\treturn fmt.Errorf(\"failed to find proxy port %s\", name)\n\t}\n\n\tif pp.nRedirects <= 0 {\n\t\tnRedirects := pp.nRedirects\n\t\tpp.nRedirects = 0\n\t\treturn fmt.Errorf(\"failed to release proxy port with has non-positive reference count: %d\", nRedirects)\n\t}\n\n\tpp.nRedirects--\n\n\t// Static proxy port is not released, dynamic proxy ports are released after a delay if\n\t// still on last reference count\n\tif !pp.isStatic && pp.nRedirects == 0 && pp.releaseCancel == nil {\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\tpp.releaseCancel = cancel\n\n\t\tgo func() {\n\t\t\tselect {","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/proxy/proxyports/proxyports.go#L401-L437","documentation":"releaseProxyPort looks up the named redirect in the proxyPorts map and returns this error if no entry exists. Release of an unknown proxy name is a bookkeeping error indicating state divergence between the caller and the ProxyPorts registry.","triggerScenarios":"ReleaseProxyPort (or releaseProxyPortWithWait) is called with a redirect name that was never added, was already fully released and removed, or whose entry was removed by restore/reset logic.","commonSituations":"Double-release of the same redirect, releasing a redirect whose creation failed earlier (see error 3710's release-on-failure path), or name mismatches after agent restart/restore.","solutions":["Check for double-release paths in the caller; release only once per successful creation","Verify the redirect name matches the one used at creation/allocation","Ignore or downgrade this error in callers where release-on-failure is best-effort","If state is permanently diverged, restart the agent to rebuild the registry"],"exampleFix":"// before\nproxyPorts.ReleaseProxyPort(name)\nproxyPorts.ReleaseProxyPort(name) // second call errors\n// after\nif err := proxyPorts.ReleaseProxyPort(name); err != nil {\n    log.Debug(\"proxy port already released\", \"name\", name, \"err\", err)\n}","handlingStrategy":"try-catch","validationCode":"// Check the redirect exists before releasing\nif _, err := proxyPorts.GetProxyPort(name); err != nil {\n    return nil // nothing to release\n}","typeGuard":"func isProxyPortNotFound(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"failed to find proxy port\")\n}","tryCatchPattern":"err := proxyPorts.ReleaseProxyPort(name)\nif isProxyPortNotFound(err) {\n    log.Debug(\"proxy port already released\", \"name\", name)\n    // idempotent-release: treat as success\n}","preventionTips":["Release exactly once per successfully created redirect","Track ack/release lifecycle per redirect in the caller","Expect this error on failure paths where creation never registered the port"],"tags":["cilium","proxy-ports","release"],"backgroundTag":"proxy-port-not-found","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}