{"record":{"id":"08aad230a2f7bbf1","repo":"dgraph-io/badger","slug":"erreof","errorCode":"ErrEOF","errorMessage":"ErrEOF: End of file","messagePattern":"ErrEOF: End of file","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"y/y.go","lineNumber":30,"sourceCode":"\t\"fmt\"\n\t\"hash/crc32\"\n\t\"io\"\n\t\"math\"\n\t\"os\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"sync\"\n\t\"time\"\n\t\"unsafe\"\n\n\t\"github.com/dgraph-io/badger/v4/pb\"\n\t\"github.com/dgraph-io/ristretto/v2/z\"\n)\n\nvar (\n\t// ErrEOF indicates an end of file when trying to read from a memory mapped file\n\t// and encountering the end of slice.\n\tErrEOF = stderrors.New(\"ErrEOF: End of file\")\n\n\t// ErrCommitAfterFinish indicates that write batch commit was called after\n\t// finish\n\tErrCommitAfterFinish = stderrors.New(\"Batch commit not permitted after finish\")\n)\n\ntype Flags int\n\nconst (\n\t// Sync indicates that O_DSYNC should be set on the underlying file,\n\t// ensuring that data writes do not return until the data is flushed\n\t// to disk.\n\tSync Flags = 1 << iota\n\t// ReadOnly opens the underlying file on a read-only basis.\n\tReadOnly\n)\n\nvar (","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/dgraph-io/badger/blob/2a001d466f6b71a917319a1db41f99860e16e269/y/y.go#L12-L48","documentation":"ErrEOF is a sentinel indicating an attempt to read past the end of a memory-mapped file slice — e.g. memtable replay computes that the next entry's offset+size exceeds the mapped log-file size and returns this error instead of slicing out of bounds. It marks a normal end-of-data boundary during value-log/memtable iteration, and callers break their read loop on it rather than treating it as corruption (contrast io.ErrUnexpectedEOF, which signals a torn final entry).","triggerScenarios":"Thrown at y/y.go:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Handle it as end-of-stream: break the read loop when errors.Is(err, y.ErrEOF) and finalize normally","Do not log or propagate it as a failure in iteration paths","If it surfaces where a complete entry was expected, treat the file tail as truncated and follow value-log truncation recovery","Ensure custom readers of mmap'd files bounds-check offsets before slicing to avoid the out-of-range condition"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2a001d466f6b71a917319a1db41f99860e16e269","analyzedAt":"2026-09-05T13:00:02.264Z","contentChangedAt":"2026-09-05T13:00:02.264Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}