{"record":{"id":"cc93c5514bda7c7c","repo":"gastownhall/beads","slug":"proxy-unexpected-data-listener-address-t","errorCode":null,"errorMessage":"proxy: unexpected data listener address %T","messagePattern":"proxy: unexpected data listener address %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dbproxy/proxy/server.go","lineNumber":235,"sourceCode":"\t\tp.stats.IncBackendStop()\n\t\treleaseLock()\n\t\t_ = stopBackendBounded(p.server)\n\t\treturn fmt.Errorf(\"%w for %s: stop epoch advanced during startup\", errStartInterrupted, p.rootDir)\n\t}\n\n\taddr := fmt.Sprintf(\"127.0.0.1:%d\", p.port)\n\n\tln, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"listen on %s: %w\", addr, err)\n\t}\n\n\tp.listener = ln\n\tdefer func() { _ = ln.Close() }()\n\tp.stats.IncListenAndServe()\n\tdataPort, ok := ln.Addr().(*net.TCPAddr)\n\tif !ok {\n\t\treturn fmt.Errorf(\"proxy: unexpected data listener address %T\", ln.Addr())\n\t}\n\n\tif _, err := identity.WriteSecret(p.rootDir); err != nil {\n\t\treturn fmt.Errorf(\"write proxy secret: %w\", err)\n\t}\n\n\tvar identMu sync.RWMutex\n\tidentReply := identity.IdentReply{\n\t\tSchema:   pidfile.SchemaV2,\n\t\tRole:     pidfile.KindProxy,\n\t\tDataPort: dataPort.Port,\n\t}\n\tcontrol, err := startControl(p.rootDir, func() identity.IdentReply {\n\t\tidentMu.RLock()\n\t\tdefer identMu.RUnlock()\n\t\treturn identReply\n\t})\n\tif err != nil {","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/proxy/server.go#L217-L253","documentation":"A defensive invariant check: after net.Listen succeeds, ListenAndServe asserts the listener's address is a *net.TCPAddr so it can extract the actual bound port. If the Go runtime ever returns a non-TCP address for a tcp listener, this error aborts startup. It essentially never fires in practice.","triggerScenarios":"Only when ln.Addr() does not type-assert to *net.TCPAddr despite the listener being created with network \"tcp\" - an internal invariant violation, not a user-facing condition.","commonSituations":"Effectively only seen if the code was modified (e.g. listen network changed to \"unix\") or a custom/monkey-patched net stack is in use during testing.","solutions":["Confirm no local modifications changed the listen network away from \"tcp\"","If running a patched Go runtime or network interceptor, verify ln.Addr() returns *net.TCPAddr","Report as a bug with the %T type shown in the message"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"ln, err := net.Listen(\"tcp\", addr)\nif _, ok := ln.Addr().(*net.TCPAddr); !ok {\n    return fmt.Errorf(\"listener addr not TCP: %T\", ln.Addr())\n}","typeGuard":"func isTCPAddr(a net.Addr) bool { _, ok := a.(*net.TCPAddr); return ok }","tryCatchPattern":null,"preventionTips":["Do not modify the listen network type away from \"tcp\" in server.go","Report this error upstream as a bug if it ever occurs - it signals an invariant violation"],"tags":["invariant","internal","tcp","type-assertion"],"backgroundTag":"unexpected-listener-address-type","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}