{"record":{"id":"4a1ff0c8f93b98f2","repo":"dagger/dagger","slug":"nil-change","errorCode":null,"errorMessage":"nil change","messagePattern":"nil change","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/snapshots/diffapply_linux.go","lineNumber":201,"sourceCode":"\t\t}\n\t\ta.root = root\n\t\tprevRelease := a.release\n\t\ta.release = func() error {\n\t\t\terr := mnter.Unmount()\n\t\t\treturn multierror.Append(err, prevRelease()).ErrorOrNil()\n\t\t}\n\t}\n\n\ta.root, err = filepath.EvalSymlinks(a.root)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to resolve symlinks in %s\", a.root)\n\t}\n\treturn a, nil\n}\n\nfunc (a *applier) Apply(ctx context.Context, c *change) error {\n\tif c == nil {\n\t\treturn errors.New(\"nil change\")\n\t}\n\n\tif c.kind == continuityfs.ChangeKindUnmodified {\n\t\treturn nil\n\t}\n\n\tdstPath, err := safeJoin(a.root, c.subPath)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to join paths %q and %q\", a.root, c.subPath)\n\t}\n\tvar dstStat *syscall.Stat_t\n\tif dstfi, err := os.Lstat(dstPath); err == nil {\n\t\tstat, ok := dstfi.Sys().(*syscall.Stat_t)\n\t\tif !ok {\n\t\t\treturn errors.Errorf(\"failed to get stat_t for %T\", dstStat)\n\t\t}\n\t\tdstStat = stat\n\t} else if !os.IsNotExist(err) {","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/snapshots/diffapply_linux.go#L183-L219","documentation":"Defensive nil guard at the top of applier.Apply: the caller passed a nil *change to the diff applier. Changes are produced internally by the diff/apply machinery, so this indicates an upstream bookkeeping bug or an uninitialized change in user-authored extensions of that pipeline.","triggerScenarios":"Passing nil directly to (*applier).Apply, or a change-walk callback that appends nil entries into the change channel/slice.","commonSituations":"Custom continuityfs walkers that yield nil on skipped entries; bugs in code that builds the change list (e.g. returning nil from a factory on error without checking).","solutions":["Check for nil before calling Apply and skip or log the entry","Fix the walker/callback so it never emits nil changes","Ensure error paths that would produce a nil change return the error instead"],"exampleFix":"// before\napplier.Apply(ctx, c) // c may be nil\n// after\nif c == nil { return nil } // or log & skip\napplier.Apply(ctx, c)","handlingStrategy":"validation","validationCode":"if c == nil {\n  return errors.New(\"cannot apply nil change\")\n}\n_ = applier.Apply(ctx, c)","typeGuard":"func validChange(c *change) bool { return c != nil }","tryCatchPattern":null,"preventionTips":["Filter nil entries when collecting changes from walkers","Return errors instead of nil changes in change factories","Add assertions in walker callbacks"],"tags":["api-misuse","null-check","diff-apply"],"backgroundTag":"nil-argument","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"}