{"record":{"id":"1d619bf12504ba75","repo":"dagger/dagger","slug":"mount-hosts-override-s-w","errorCode":null,"errorMessage":"mount hosts override %s: %w","messagePattern":"mount hosts override (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/git_remote.go","lineNumber":757,"sourceCode":"\t}\n\tif err := unix.Setns(int(cleanMntNS.Fd()), unix.CLONE_NEWNS); err != nil {\n\t\treturn fmt.Errorf(\"setns clean mount namespace: %w\", err)\n\t}\n\tif err := unix.Unshare(unix.CLONE_NEWNS); err != nil {\n\t\treturn fmt.Errorf(\"unshare new mount namespace: %w\", err)\n\t}\n\n\tsyscall.Umask(0022)\n\tif err := overrideNetworkConfig(hosts, resolv); err != nil {\n\t\treturn fmt.Errorf(\"failed to override network config: %w\", err)\n\t}\n\treturn runProcessGroup(ctx, cmd)\n}\n\nfunc overrideNetworkConfig(hostsOverride, resolvOverride string) error {\n\tif hostsOverride != \"\" {\n\t\tif err := mount.Mount(hostsOverride, \"/etc/hosts\", \"\", \"bind\"); err != nil {\n\t\t\treturn fmt.Errorf(\"mount hosts override %s: %w\", hostsOverride, err)\n\t\t}\n\t}\n\tif resolvOverride != \"\" {\n\t\tif err := mount.Mount(resolvOverride, \"/etc/resolv.conf\", \"\", \"bind\"); err != nil {\n\t\t\treturn fmt.Errorf(\"mount resolv override %s: %w\", resolvOverride, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc runProcessGroup(ctx context.Context, cmd *exec.Cmd) error {\n\tcmd.SysProcAttr = &unix.SysProcAttr{\n\t\tSetpgid:   true,\n\t\tPdeathsig: unix.SIGTERM,\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\treturn err","sourceCodeStart":739,"sourceCodeEnd":775,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/git_remote.go#L739-L775","documentation":"Bind-mounting the prepared hosts-override file over /etc/hosts failed inside the isolated mount namespace. The %s names the temp file being mounted; typical failures are the temp file missing, the target being a symlink on read-only /etc, or propagation/type mismatch.","triggerScenarios":"Thrown at core/git_remote.go:757 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the temp hosts file still exists at mount time (no early cleanup)","If /etc/hosts is a symlink, mount onto its resolved target instead","Check for ENOMEM/busy mount-table errors and retry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}