{"record":{"id":"af7722e6ce7b598e","repo":"dagger/dagger","slug":"failed-to-get-mtime-of-updated-bundle-w","errorCode":null,"errorMessage":"failed to get mtime of updated bundle: %w","messagePattern":"failed to get mtime of updated bundle: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/engineutil/cacerts/distros.go","lineNumber":417,"sourceCode":"\t\tif err := d.ctrFS.WriteFile(destPath, []byte(certContents+\"\\n\"), 0644); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcleanups.append(func() error {\n\t\t\treturn d.ctrFS.Remove(destPath)\n\t\t})\n\t}\n\n\tif d.updateCommandExisted {\n\t\t// prepend cleanup instead of append so uninstall runs last after other cleanups have ran\n\t\tcleanups.prepend(func() error {\n\t\t\treturn d.ctrFS.Exec(ctx, d.updateCmd...)\n\t\t})\n\t\tif err := d.ctrFS.Exec(ctx, d.updateCmd...); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to run %v for install: %w\", d.updateCmd, err)\n\t\t}\n\t\td.updatedBundleMtime, err = d.ctrFS.MtimeOf(d.bundlePath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get mtime of updated bundle: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif d.bundleExisted {\n\t\torigBundleContents, err := d.ctrFS.ReadFile(d.bundlePath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read existing bundle: %w\", err)\n\t\t}\n\t\tcleanups.append(func() error {\n\t\t\tif err := d.ctrFS.WriteFile(d.bundlePath, origBundleContents, 0644); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := d.ctrFS.SetMtime(d.bundlePath, d.originalBundleMtime); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to set mtime of bundle during install: %w\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\t})","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/engineutil/cacerts/distros.go#L399-L435","documentation":"During commonInstaller.Install at engine/engineutil/cacerts/distros.go:417, errors from d.ctrFS.MtimeOf(d.bundlePath) after the update command ran are wrapped with this message. The updated mtime is captured so the library can detect whether the update tool actually regenerated the bundle. It fires when the bundle's mtime cannot be read after the updater supposedly produced/refreshed it.","triggerScenarios":"updateCommandExisted==true, the update command succeeded, then MtimeOf(bundlePath) fails: the updater deleted the bundle instead of updating it, the bundle is a dangling symlink, or stat permission/I/O error.","commonSituations":"Distro updater regenerates the bundle at a different path (symlink retargeted), leaving a dangling link; concurrent cleanup removed the bundle; restricted FS after exec.","solutions":["Check that bundlePath resolves to a real file after running the update tool manually.","Fix the distro bundle symlink so it points at the updater's output path.","Ensure no concurrent process removes the bundle between the update exec and mtime read.","Retry Install if the stat failure was transient."],"exampleFix":"// before: dangling bundle symlink after updater ran\nls -l /etc/ssl/certs/ca-certificates.crt -> /etc/ssl/certs/old-bundle.pem (missing)\n// after\nln -sf /etc/ca-certificates/extracted/tls-ca-bundle.pem /etc/ssl/certs/ca-certificates.crt","handlingStrategy":"try-catch","validationCode":"// after a manual run of the updater, confirm the bundle still resolves\nreadlink -f /etc/ssl/certs/ca-certificates.crt || echo 'bundle symlink broken'","typeGuard":"func resolves(path string) bool {\n\tresolved, err := filepath.EvalSymlinks(path)\n\treturn err == nil && resolved != \"\"\n}","tryCatchPattern":"err := installer.Install(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to get mtime of updated bundle\") {\n\t// updater removed/retargeted the bundle; restore it and retry\n}","preventionTips":["Confirm the distro updater writes to the same bundlePath the installer expects.","Keep the bundle symlink target stable across updater runs.","Avoid concurrent bundle cleanup during Install.","Use distro-standard bundle locations instead of custom ones."],"tags":["filesystem","mtime","exec","ca-certificates","go"],"backgroundTag":"stat-failed","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"}