{"record":{"id":"45e03ded5dcdbc08","repo":"dagger/dagger","slug":"verify-modified-file-w","errorCode":null,"errorMessage":"verify modified file: %w","messagePattern":"verify modified file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/changeset_delta.go","lineNumber":334,"sourceCode":"// (e.g. an added empty dir) don't. Added or removed files prove the changeset\n// non-empty regardless of how git would pair them into renames, and\n// metadata-suspect files are verified by content with an early exit on the\n// first real difference.\nfunc changesetDeltaIsEmpty(ctx context.Context, beforeDir, afterDir string) (bool, error) {\n\tdelta, err := collectChangesetDelta(ctx, beforeDir, afterDir)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"collect delta: %w\", err)\n\t}\n\tif len(delta.addedFiles) > 0 || len(delta.removedFiles) > 0 {\n\t\treturn false, nil\n\t}\n\tfor _, rel := range delta.modifiedCandidates {\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn false, context.Cause(ctx)\n\t\t}\n\t\tchanged, err := modifiedFileDiffers(beforeDir, afterDir, rel)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"verify modified file: %w\", err)\n\t\t}\n\t\tif changed {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\treturn true, nil\n}\n\n// gitFileMode maps a file's mode onto the modes git tracks: symlink, and\n// executable vs regular file. Other permission bits are invisible to git.\nfunc gitFileMode(fi os.FileInfo) uint32 {\n\tif fi.Mode()&os.ModeSymlink != 0 {\n\t\treturn 0o120000\n\t}\n\tif fi.Mode()&0o111 != 0 {\n\t\treturn 0o100755\n\t}\n\treturn 0o100644","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/changeset_delta.go#L316-L352","documentation":"changesetDeltaIsEmpty wraps errors from modifiedFileDiffers for each metadata-suspect candidate with 'verify modified file'. It means content/mode verification of a specific modified file failed — a stat or readlink error (errors 344–347) bubbled up during the emptiness check.","triggerScenarios":"A modified candidate's file vanishes or becomes unreadable between the metadata walk and the content verification loop in changesetDeltaIsEmpty — races with writers mutating either tree mid-check.","commonSituations":"Editors, build daemons, or codegen touching files while an emptiness check runs; cache layers being evicted; permission changes applied concurrently.","solutions":["Read the wrapped error to identify the failing file and fix its cause (permissions, deletion)","Re-run the check with both trees stable/frozen","Stop concurrent writers (builds, formatters) during the diff","If caused by a genuinely missing file, re-materialize the snapshot"],"exampleFix":"// before: gofmt -w running while emptiness is checked\nexec.Command(\"gofmt\", \"-w\", dir).Start()\nempty, err := changesetDeltaIsEmpty(ctx, beforeDir, afterDir)\n// after: format first, then check\nexec.Command(\"gofmt\", \"-w\", dir).Run()\nempty, err := changesetDeltaIsEmpty(ctx, beforeDir, afterDir)","handlingStrategy":"try-catch","validationCode":"if _, err := os.Lstat(filepath.Join(beforeDir, rel)); err != nil {\n    return fmt.Errorf(\"candidate before side gone: %w\", err)\n}\nif _, err := os.Lstat(filepath.Join(afterDir, rel)); err != nil {\n    return fmt.Errorf(\"candidate after side gone: %w\", err)\n}","typeGuard":"func verifiable(rootA, rootB, rel string) bool {\n    _, e1 := os.Lstat(filepath.Join(rootA, rel))\n    _, e2 := os.Lstat(filepath.Join(rootB, rel))\n    return e1 == nil && e2 == nil\n}","tryCatchPattern":"empty, err := changesetDeltaIsEmpty(ctx, beforeDir, afterDir)\nif err != nil {\n    if errors.Is(err, fs.ErrNotExist) {\n        return false, nil // a candidate changed mid-check: not empty\n    }\n    return false, fmt.Errorf(\"verify modified file: %w\", err)\n}","preventionTips":["Stop formatters/builders that touch files during the check","Unwrap to identify the specific failing file","Retry once after quiescing writers","Re-materialize snapshots if files are genuinely missing"],"tags":["filesystem","verification","diff"],"backgroundTag":"file-not-found","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"}