{"record":{"id":"6a5ab1c0f4b5dd83","repo":"JuliusBrussee/caveman","slug":"native-runtime-inspect-socket-w","errorCode":null,"errorMessage":"native runtime inspect socket: %w","messagePattern":"native runtime inspect socket: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/nativeruntime/server_unix.go","lineNumber":52,"sourceCode":"\t\treturn errors.New(\"native runtime: store is required\")\n\t}\n\tif err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {\n\t\treturn fmt.Errorf(\"native runtime mkdir: %w\", err)\n\t}\n\tif err := os.Chmod(filepath.Dir(path), 0o700); err != nil {\n\t\treturn fmt.Errorf(\"native runtime chmod dir: %w\", err)\n\t}\n\tif _, err := os.Stat(path); err == nil {\n\t\tconn, dialErr := net.DialTimeout(\"unix\", path, 50*time.Millisecond)\n\t\tif dialErr == nil {\n\t\t\t_ = conn.Close()\n\t\t\treturn errors.New(\"native runtime: socket already active\")\n\t\t}\n\t\tif err := os.Remove(path); err != nil {\n\t\t\treturn fmt.Errorf(\"native runtime remove stale socket: %w\", err)\n\t\t}\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"native runtime inspect socket: %w\", err)\n\t}\n\tlistener, err := net.Listen(\"unix\", path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"native runtime listen: %w\", err)\n\t}\n\tdefer listener.Close()\n\tdefer os.Remove(path)\n\tif err := os.Chmod(path, 0o600); err != nil {\n\t\treturn fmt.Errorf(\"native runtime chmod socket: %w\", err)\n\t}\n\tgo func() {\n\t\t<-ctx.Done()\n\t\t_ = listener.Close()\n\t}()\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tif ctx.Err() != nil {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/proxy/internal/nativeruntime/server_unix.go#L34-L70","documentation":"ServeUnix stats the intended socket path to classify it as absent, stale, or live. os.Stat returned an error that is neither nil (exists) nor IsNotExist (cleanly absent) — i.e. an ambiguous state such as EACCES on a parent directory (path hidden from this user) or ELOOP. The runtime refuses to guess whether a listener is active.","triggerScenarios":"A parent directory of the socket path is mode 0700 owned by another user, so stat gets permission denied; symlink loop on the path; path too long (ENAMETOOLONG).","commonSituations":"Multi-user machines with restrictive /run or /tmp subdirectories; deep socket paths exceeding PATH_MAX in wrappers.","solutions":["Check the wrapped errno: EACCES means a parent dir hides the path — fix its permissions or ownership","Shorten or flatten the socket path","Remove symlink loops at or along the path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func socketPathReachable(p string) error {\n    _, err := os.Stat(filepath.Dir(p)) // EACCES here means a parent hides the path\n    if err != nil && !os.IsNotExist(err) {\n        return fmt.Errorf(\"cannot inspect socket path: %w\", err)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give the running user read+execute on every parent of the socket path","Keep socket paths short and symlink-free","Use a dedicated per-user runtime directory, not shared restrictive ones"],"tags":["unix-socket","permissions","nativeruntime","startup"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}